Comparing version 0.0.2 to 0.0.3
@@ -74,14 +74,8 @@ /* | ||
// Register a slot in the next step and return a callback | ||
Group.prototype.slot = function slot() { | ||
Group.prototype.slot = function slot(argLength) { | ||
this.debug && console.log("slotting", this.left); | ||
if (arguments.length) { | ||
for (var i = 0; i < arguments.length; i++) { | ||
this.pass(arguments[i]); | ||
} | ||
return; | ||
} | ||
if (!argLength) argLength = 1; | ||
var group = this; | ||
var index = group.args.length; | ||
group.args.length++; | ||
group.args.length += argLength; | ||
group.left++; | ||
@@ -92,6 +86,9 @@ if (this.firstSlotCallback) { // mcav | ||
} | ||
return function (err, data) { | ||
return function (err) { | ||
group.debug && console.log("slot DONE", group.left); | ||
if (err) return group.error(err); | ||
group.args[index] = data; | ||
var values = slice.call(arguments, 1); | ||
for (var i = 0; i < argLength; i++) { | ||
group.args[index + i] = values[i] || null; | ||
} | ||
if (--group.left === 0) group.done(); | ||
@@ -98,0 +95,0 @@ }; |
{ | ||
"name": "ff", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Asynchronous flow control library for node (and browsers)", | ||
@@ -5,0 +5,0 @@ "engine": [ "node >=0.2.0" ], |
6024
180