1.0.3 • Published 6 years ago

@handout/handout v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Build Status GitHub tag David MIT Licence

BETA: Use at your own risk!

Features

  • Use of latest web standards to stay small and quick ( check compatibility section for details )
  • Track request loading and progress automatically
  • Modular and extensible through plugins and events/filters
  • Promise-based responses

Installation

install the package: npm install @handout/handout

import into your code

import Handout from '@handout/handout';

The library is built as an ES6 module, to use it in the browser you need to transpile it using one of the many tools available ( Babel, Bublè, etc )

Quick start

Submit a form on the page

const form = document.querySelector('form');

new Handout(form)
  .submit()
  .then(response => {
    if (response.status >= 400) {
      // Handle response error
    } else {
      // Handle response data
      console.log(response.data);
    }
  }).catch(error => {
    // Handle request error
  });

Add data programmatically

new Handout('http://your-awesome-api.com', 'post')
  .add('name', 'John')
  .add('surname', 'Doe')
  .submit()
  .then(response => {
    // Handle response
  }).catch(error => {
    // Handle errors
  });

Events and Filters

The library supports a variety of events and filters to extend its behaviour, for a full list of all events and filters available check the events section.

Plugins

The core functionality is quite basic, but can be easily extended through plugins.

Official plugins:

Compatibility

ChromeFirefoxSafariEdge
last 2 versionslast 2 versionslast 2 versionsEdge

To support IE11 you need FormData and Promise polyfills

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago