summaryrefslogtreecommitdiff
path: root/lib/async.js
diff options
context:
space:
mode:
authorCaolan McMahon <caolan@caolanmcmahon.com>2013-01-31 13:52:55 +0000
committerCaolan McMahon <caolan@caolanmcmahon.com>2013-01-31 13:52:55 +0000
commit089d94b3ac96b3a1a1aab42672f793c1b2dbfe46 (patch)
treed2045d081f4282be883ef6ba3c8fe0f1c952d640 /lib/async.js
parentbee45ddd8655de34befb7d5ae3bc665b42666c25 (diff)
parent7d1827063ea28bb06b4ac492323c1cdd7b9e5df0 (diff)
downloadasync-089d94b3ac96b3a1a1aab42672f793c1b2dbfe46.tar.gz
Merge remote branch 'dpatti/auto-fix'
Conflicts: dist/async.min.js
Diffstat (limited to 'lib/async.js')
-rw-r--r--lib/async.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/async.js b/lib/async.js
index baf5820..b5ba2ea 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -406,6 +406,7 @@
});
_forEach(keys, function (k) {
+ var fired = false;
var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
var taskCallback = function (err) {
if (err) {
@@ -426,7 +427,7 @@
var ready = function () {
return _reduce(requires, function (a, x) {
return (a && results.hasOwnProperty(x));
- }, true) && !results.hasOwnProperty(k);
+ }, true) && !fired;
};
if (ready()) {
task[task.length - 1](taskCallback, results);
@@ -435,6 +436,7 @@
var listener = function () {
if (ready()) {
removeListener(listener);
+ fired = true;
task[task.length - 1](taskCallback, results);
}
};