From dd367f60366a5bbe26e75265156c83a0a16b485b Mon Sep 17 00:00:00 2001 From: "Ma, Tianxiao" Date: Tue, 20 May 2014 14:51:14 +0800 Subject: [PATCH] Fix indexOf parameter bug Parameter for Arrary.indexOf should be the value of the element, not the index of the element. --- examples/todomvc-flux/js/dispatcher/Dispatcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/todomvc-flux/js/dispatcher/Dispatcher.js b/examples/todomvc-flux/js/dispatcher/Dispatcher.js index 7adf400245b..7aab2b13d9c 100644 --- a/examples/todomvc-flux/js/dispatcher/Dispatcher.js +++ b/examples/todomvc-flux/js/dispatcher/Dispatcher.js @@ -109,7 +109,7 @@ Dispatcher.prototype = merge(Dispatcher.prototype, { */ waitFor: function(/*array*/ promiseIndexes, /*function*/ callback) { var selectedPromises = _promises.filter(function(/*object*/ _, /*number*/ j) { - return promiseIndexes.indexOf(j) !== -1; + return promiseIndexes.indexOf(_) !== -1; }); Promise.all(selectedPromises).then(callback); }