@samitouri / QOS-React-2 / commits / e58899cdff

Make promise selection logic clearer

Ben Alpert committed May 20, 2014 at 17:09 UTC e58899cdff9184890eab30b5fc67ffff774e7162
1 file changed +2 -2
examples/todomvc-flux/js/dispatcher/Dispatcher.js
+2 -2
@@ -108,8 +108,8 @@ 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) {
111 - var selectedPromises = _promises.filter(function(/*object*/ _, /*number*/ j) {
112 - return promiseIndexes.indexOf(j) !== -1;
111 + var selectedPromises = promiseIndexes.map(function(idx) {
112 + return _promises[idx];
113 });
114 Promise.all(selectedPromises).then(callback);
115 }