Comparing version 0.0.3 to 0.0.4
13
index.js
@@ -112,3 +112,3 @@ 'use strict'; | ||
if (xhr.readyState >= 3 && status.code === 200 && (data = response(xhr))) { | ||
ee.emit('stream', data); | ||
ee.emit('stream', data, status); | ||
} | ||
@@ -129,4 +129,13 @@ }; | ||
if (status.code < 100 || status.code > 599) return onerror(evt); | ||
if (data) ee.emit('stream', data); | ||
// | ||
// There is a bug in FireFox's XHR2 implementation where status code 204 | ||
// triggers a "no element found" error and bad data. So to be save here, | ||
// we're just **never** going to emit a `stream` event as for 204's there | ||
// shouldn't be any content. | ||
// | ||
if (data && status.code !== 204) { | ||
ee.emit('stream', data, status); | ||
} | ||
ee.emit('end', undefined, status); | ||
@@ -133,0 +142,0 @@ }); |
{ | ||
"name": "loads", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Dedicated listening for xhr requests.", | ||
@@ -31,3 +31,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"failure": "1.0.x", | ||
"failure": "1.1.x", | ||
"one-time": "0.0.x", | ||
@@ -42,4 +42,4 @@ "xhr-response": "1.0.x", | ||
"mocha": "2.2.x", | ||
"pre-commit": "1.0.x" | ||
"pre-commit": "1.1.x" | ||
} | ||
} |
# loads | ||
[![Made by unshift][made-by]](http://unshift.io)[![Version | ||
npm][version]](http://browsenpm.org/package/loads)[![Build | ||
Status][build]](https://travis-ci.org/unshiftio/loads)[![Dependencies][david]](https://david-dm.org/unshiftio/loads)[![Coverage | ||
Status][cover]](https://coveralls.io/r/unshiftio/loads?branch=master)[![IRC channel][irc]](http://webchat.freenode.net/?channels=unshift) | ||
[![Made by unshift][made-by]](http://unshift.io)[![Version npm][version]](http://browsenpm.org/package/loads)[![Build Status][build]](https://travis-ci.org/unshiftio/loads)[![Dependencies][david]](https://david-dm.org/unshiftio/loads)[![Coverage Status][cover]](https://coveralls.io/r/unshiftio/loads?branch=master)[![IRC channel][irc]](https://webchat.freenode.net/?channels=unshift) | ||
@@ -15,4 +12,4 @@ [made-by]: https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square | ||
Loads is a small helper library which automatically assign and listen to the | ||
various of XHR event hooks and emit the corrected and normalized responses over | ||
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. | ||
@@ -40,3 +37,3 @@ | ||
ee.on('stream', function (data) { | ||
// data chunks received. | ||
// data chunk received. | ||
}); | ||
@@ -52,2 +49,2 @@ | ||
MIT | ||
[MIT](LICENSE) |
8090
4
141
48
+ Addedfailure@1.1.1(transitive)
- Removedfailure@1.0.0(transitive)
Updatedfailure@1.1.x