0.0.6 • Published 9 years ago

xhrhelpers v0.0.6

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

xhrhelpers

Build Status

xhrhelpers contains function to help interacting with XHR objects through promises.

Usage

  • Use the XHR status
promisifiedXHR
    .then(xhrHelpers.status)
    .then(console.log); // Logs the status of the xhr
  • Use the XHR response object
promisifiedXHR
    .then(xhrHelpers.responseObject)
    .then(console.log); // Logs the response object of the xhr
  • Use the XHR response text
promisifiedXHR
    .then(xhrHelpers.responseText)
    .then(console.log); // Logs the response text of the xhr
  • Check if the status code was successful (under 299)
promisifiedXHR
    .then(xhrHelpers.twoHundredsOrThrow)
    .then(console.log); // Throws an error if the status code was > 299

Install it

$ npm install xhrhelpers

Test it

$ npm test

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

10 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago