mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make promise selection logic clearer
This commit is contained in:
@@ -108,8 +108,8 @@ Dispatcher.prototype = merge(Dispatcher.prototype, {
|
||||
* A more robust Dispatcher would issue a warning in this scenario.
|
||||
*/
|
||||
waitFor: function(/*array*/ promiseIndexes, /*function*/ callback) {
|
||||
var selectedPromises = _promises.filter(function(/*object*/ _, /*number*/ j) {
|
||||
return promiseIndexes.indexOf(j) !== -1;
|
||||
var selectedPromises = promiseIndexes.map(function(idx) {
|
||||
return _promises[idx];
|
||||
});
|
||||
Promise.all(selectedPromises).then(callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user