Executor works with arguments

pull/2/head
Louis Chatriot 12 years ago
parent c88026cf86
commit f28313f1a3
  1. 6
      lib/executor.js

@ -14,7 +14,7 @@ executor = async.queue(function (task, cb) {
// Always tell the queue task is complete. Execute callback if any was given. // Always tell the queue task is complete. Execute callback if any was given.
if (typeof lastArg === 'function') { if (typeof lastArg === 'function') {
callback = function () { callback = function () {
lastArg(arguments); lastArg.apply(null, arguments);
cb(); cb();
}; };
@ -50,11 +50,11 @@ function test2 (msg, cb) {
setTimeout(function () { setTimeout(function () {
console.log("Ola " + msg); console.log("Ola " + msg);
callback(); callback('YEAH');
}, 500); }, 500);
} }
function bloup () { console.log("FINISHED"); } function bloup () { console.log("FINISHED"); console.log(arguments); }
executor.push({ this: null, fn: test1, arguments: [ 'world' ] }); executor.push({ this: null, fn: test1, arguments: [ 'world' ] });
executor.push({ this: null, fn: test2, arguments: [ 'world', bloup ] }); executor.push({ this: null, fn: test2, arguments: [ 'world', bloup ] });

Loading…
Cancel
Save