From f28313f1a3dbd8036b909c2c9d4a2fc8acddfe47 Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Tue, 21 May 2013 08:57:27 +0200 Subject: [PATCH] Executor works with arguments --- lib/executor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/executor.js b/lib/executor.js index 10d328a..b9018fe 100644 --- a/lib/executor.js +++ b/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. if (typeof lastArg === 'function') { callback = function () { - lastArg(arguments); + lastArg.apply(null, arguments); cb(); }; @@ -50,11 +50,11 @@ function test2 (msg, cb) { setTimeout(function () { console.log("Ola " + msg); - callback(); + callback('YEAH'); }, 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: test2, arguments: [ 'world', bloup ] });