Update Dispatcher.js
I think Array.filter expects a boolean return value, am I correct?
volkanunsal committed
May 4, 2014 at 19:04 UTC
31477dbf946283fbb52a7e434174f23fc4e4a0ca
1 file changed
+4
-4
examples/todomvc-flux/js/dispatcher/Dispatcher.js
+4
-4
@@ -53,9 +53,9 @@ var _clearPromises = function() {
53
* Used below in waitFor().
54
* @param {number} index The index within the _promises array
55
*/
56
-var _getPromise = function(index) {
57
- return _promises[index];
58
-};
56
+var _checkPromise = function(_,j){
57
+ return promiseIndexes.indexOf(j) !== -1;
58
+}
59
60
var Dispatcher = function() {};
61
Dispatcher.prototype = merge(Dispatcher.prototype, {
@@ -116,7 +116,7 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
116
* A more robust Dispatcher would issue a warning in this scenario.
117
*/
118
waitFor: function(/*array*/ promiseIndexes, /*function*/ callback) {
119
- var selectedPromises = promiseIndexes.filter(_getPromise);
119
+ var selectedPromises = _promises.filter(_checkPromise)
120
Promise.all(selectedPromises).then(callback);
121
}
122