Comparing version 0.0.2 to 0.0.3
10
index.js
@@ -39,9 +39,7 @@ 'use strict'; | ||
onerror = xhr.onerror = one(function onerror(evt) { | ||
var err = fail( | ||
new Error('Network request failed'), | ||
statuscode(xhr) | ||
); | ||
var status = statuscode(xhr) | ||
, err = fail(new Error('Network request failed'), status); | ||
ee.emit('error', err); | ||
ee.emit('end', err); | ||
ee.emit('end', err, status); | ||
}); | ||
@@ -133,3 +131,3 @@ | ||
ee.emit('end'); | ||
ee.emit('end', undefined, status); | ||
}); | ||
@@ -136,0 +134,0 @@ |
{ | ||
"name": "loads", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Dedicated listening for xhr requests.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
14
test.js
@@ -46,2 +46,16 @@ describe('loads', function () { | ||
it('receives the status code in the `end` event', function (next) { | ||
next = assume.plan(2, next); | ||
ee | ||
.on('end', function (err, status) { | ||
assume(err).to.be.a('undefined'); | ||
assume(status.code).equals(200); | ||
next(); | ||
}); | ||
loads(xhr, ee).emit('load'); | ||
}); | ||
it('emits an `error` before `end` when `load` has an incorrect status', function (next) { | ||
@@ -48,0 +62,0 @@ next = assume.plan(3, next); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10656
268
0