Skip to content

Commit

Permalink
Merge pull request #89 from jerry1100/fix-parser-listener
Browse files Browse the repository at this point in the history
Fix followProgress() not triggering progress handler
  • Loading branch information
apocas authored Mar 4, 2018
2 parents 595a873 + 643c864 commit 78e793b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/modem.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Modem.prototype.followProgress = function(stream, onFinished, onProgress) {
var parser = JSONStream.parse(),
output = [];

parser.on('root', onStreamEvent);
parser.on('data', onStreamEvent);
parser.on('error', onStreamError);
parser.on('end', onStreamEnd);

Expand All @@ -332,7 +332,7 @@ Modem.prototype.followProgress = function(stream, onFinished, onProgress) {
}

function onStreamError(err) {
parser.removeListener('root', onStreamEvent);
parser.removeListener('data', onStreamEvent);
parser.removeListener('error', onStreamError);
parser.removeListener('end', onStreamEnd);
onFinished(err, output);
Expand Down

0 comments on commit 78e793b

Please sign in to comment.