Skip to content

Commit

Permalink
Merge pull request facebook#1575 from spicyj/dispatch-index
Browse files Browse the repository at this point in the history
Make promise selection logic clearer
  • Loading branch information
sophiebits committed May 21, 2014
2 parents cccdc54 + e58899c commit 49652c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/todomvc-flux/js/dispatcher/Dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 49652c8

Please sign in to comment.