Permalink
Browse files

added 'drain' event

  • Loading branch information...
1 parent 2dfa14f commit da1e29ea39f4b1f817875f3e0217ed94d56edd78 @ybogdanov committed Aug 11, 2011
Showing with 7 additions and 2 deletions.
  1. +6 −1 lib/narrow.js
  2. +1 −1 package.json
View
@@ -216,10 +216,15 @@ Narrow.prototype._doTask = function(task) {
self.stop();
// if there are no tasks in progress left, just emit 'end'
if (!self._inprog) {
- this.emit('end');
+ self.emit('end');
}
}
+ // emit drain event
+ if (self._inprog + self._buffer.length == 0) {
+ self.emit('drain');
+ }
+
self.emit('free');
}
View
@@ -1,7 +1,7 @@
{
"name": "narrow",
"description": "Library shrinks a given callback parallel execution concurrency in a limited number of threads, receiving the bunch of data (array of tasks).",
- "version": "v0.0.1",
+ "version": "v0.0.2",
"url": "http://github.com/0ctave/node-narrow",
"author": "Yuriy Bogdanov <chinsay@gmail.com>",
"main": "lib/narrow",

0 comments on commit da1e29e

Please sign in to comment.