From 916d52f2186fa04a3dc851d5dddcf2cf13e5cb72 Mon Sep 17 00:00:00 2001 From: Mick Hansen Date: Tue, 22 Oct 2013 09:37:48 +0200 Subject: [PATCH] Refactor done() to apply args given, so as not to allways call with 2nd param, as this messes with async.js auto --- lib/emitters/custom-event-emitter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/emitters/custom-event-emitter.js b/lib/emitters/custom-event-emitter.js index bb59ad969cc5..b4be9b01c4a4 100644 --- a/lib/emitters/custom-event-emitter.js +++ b/lib/emitters/custom-event-emitter.js @@ -49,7 +49,11 @@ module.exports = (function() { function(fct) { fct = bindToProcess(fct); this.on('error', function(err) { fct(err, null) }) - .on('success', function(arg0, arg1) { fct(null, arg0, arg1) }) + .on('success', function() { + var args = Array.prototype.slice.call(arguments); + args.unshift(null); + fct.apply(fct, args); + }) return this }