Permalink
Browse files

Small tidy up in next.parallel

  • Loading branch information...
1 parent 2084237 commit 2a3c55e4a2d9c47bde37e2f119b80340dde9de15 @tim-smart committed Jun 19, 2010
Showing with 6 additions and 8 deletions.
  1. +5 −8 lib/parallel/index.js
  2. +1 −0 test.js
View
@@ -106,14 +106,11 @@ Sequence.prototype.run = function run(callback) {
results.push(arguments[1]);
counter--;
if (counter <= 0) {
- var temp_results = results, temp_error = error;
- counter = 0;
- error = null;
- results = [];
- temp_results.unshift(temp_results.slice());
- temp_results.unshift(temp_error);
- temp_results.unshift(next);
- next.apply(null, temp_results);
+ results.unshift(results.slice());
+ results.unshift(error);
+ results.unshift(next);
+ next.apply(null, results);
+ counter = 0; results = []; error = null;
}
};
};
View
@@ -25,6 +25,7 @@ task.run(function (task_name, err, data) {
}
});
+// Also accepts an array
var seq = new parallel.Sequence(
function (next) {
sys.puts('sequence-1');

0 comments on commit 2a3c55e

Please sign in to comment.