buffered-xhr-stream
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -12,7 +12,2 @@ var Stream = require('./index') | ||
// stream.on('data', function (d) { | ||
// if (++count % 10 ==0) { | ||
// stream.pause() | ||
// } | ||
// }) | ||
stream.pipe(JSONStream.parse(['rows', true])).on('data', function (d) { | ||
@@ -19,0 +14,0 @@ if (++count % 50 == 0) { |
11
index.js
@@ -29,2 +29,8 @@ var stream = require('stream') | ||
} | ||
} else if (this.xhr.readyState === 4) { | ||
flush(this) | ||
if (this.xhr.error) { | ||
this.emit('error') | ||
} | ||
} | ||
@@ -52,3 +58,3 @@ } | ||
if (stream.xhr.readyState === 4 && stream.offset === stream.xhr.responseText.length) { | ||
if (stream.offset === stream.xhr.responseText.length) { | ||
stream.emit('end') | ||
@@ -67,5 +73,2 @@ } | ||
Stream.prototype.resume = function () { | ||
if (this._state !== 'paused') { | ||
return | ||
} | ||
this._state = 'flowing' | ||
@@ -72,0 +75,0 @@ flush(this) |
{ | ||
"name": "buffered-xhr-stream", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A pausable/resumable xhr stream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3181
91