mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Update Dispatcher.js
I think Array.filter expects a boolean return value, am I correct?
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user