Update Dispatcher.js
volkanunsal committed
May 4, 2014 at 19:15 UTC
c81c07c816ba782d6e15c661ed512a35f6b26c1f
1 file changed
+1
-9
examples/todomvc-flux/js/dispatcher/Dispatcher.js
+1
-9
@@ -49,14 +49,6 @@ var _clearPromises = function() {
49
_promises = [];
50
};
51
52
-/**
53
- * Used below in waitFor().
54
- * @param {number} index The index within the _promises array
55
- */
56
-var _checkPromise = function(_,j){
57
- return _promises.indexOf(j) !== -1;
58
-}
59
-
52
var Dispatcher = function() {};
53
Dispatcher.prototype = merge(Dispatcher.prototype, {
54
@@ -116,7 +108,7 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
108
* A more robust Dispatcher would issue a warning in this scenario.
109
*/
110
waitFor: function(/*array*/ promiseIndexes, /*function*/ callback) {
119
- var selectedPromises = _promises.filter(_checkPromise)
111
+ var selectedPromises = _promises.filter(function(_,j){return promiseIndexes.indexOf(j) !== -1;})
112
Promise.all(selectedPromises).then(callback);
113
}
114