Skip to content

Small helper library for handling load events on XHR objects.

License

Notifications You must be signed in to change notification settings

unshiftio/loads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loads

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

Loads is a small helper library which automatically assigns and listens to the various of XHR event hooks and emits the corrected and normalized responses over a supplied EventEmitter instance.

Installation

This module was primary developed with browsers in mind and is released in the public npm registry. It can be installed by running:

npm install --save loads

Usage

var loads = require('loads')
  , xhr = new XMLHTTPRequest()
  , EventEmitter = require('events').EventEmitter;

var ee = new EventEmitter();
loads(xhr, ee);

ee.on('stream', function (data) {
  // data chunk received.
});

ee.on('end', function () {});

xhr.open(url);
xhr.send();

License

MIT

About

Small helper library for handling load events on XHR objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published