Skip to content

unshiftio/xhr-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xhr-response

Made by unshiftVersion npmBuild StatusDependenciesCoverage StatusIRC channel

The xhr-response is a small helper library for safely extracting response data from XHR requests. There are some minor bugs in browsers which can cause exceptions to be thrown when accessing the wrong properties of an XHR request instance. This module works around these bugs.

Installation

This module is primary written for client-side code and uses the commonjs module pattern for exporting.

npm install --save xhr-response

Usage

It's just as simple as:

var response = require("xhr-response");

var xhr = new XMLHTTPRequest();
// .. stuffs ..

xhr.onload = function () {
  var data = response(xhr);

  console.log('data', data);
};

License

MIT

About

Safely extract the XHR response from your XHR instance.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •