Update Dispatcher.js

I think Array.filter expects a boolean return value, am I correct?
This commit is contained in:
volkanunsal
2014-05-04 19:04:51 -04:00
parent f1096c6bb3
commit 31477dbf94
@@ -53,9 +53,9 @@ var _clearPromises = function() {
* Used below in waitFor().
* @param {number} index The index within the _promises array
*/
var _getPromise = function(index) {
return _promises[index];
};
var _checkPromise = function(_,j){
return promiseIndexes.indexOf(j) !== -1;
}
var Dispatcher = function() {};
Dispatcher.prototype = merge(Dispatcher.prototype, {
@@ -116,7 +116,7 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
* A more robust Dispatcher would issue a warning in this scenario.
*/
waitFor: function(/*array*/ promiseIndexes, /*function*/ callback) {
var selectedPromises = promiseIndexes.filter(_getPromise);
var selectedPromises = _promises.filter(_checkPromise)
Promise.all(selectedPromises).then(callback);
}