@ -583,7 +591,7 @@ Adding Dependency Management to the Dispatcher
As I said previously, our Dispatcher implementation is a bit naive. It's pretty good, but it will not suffice for most applications. We need a way to be able to manage dependencies between Stores. Let's add that functionality with a waitFor() method within the main body of the Dispatcher class.
We'll need another public method, waitFor().
We'll need another public method, waitFor(). Note that it returns a Promise that can in turn be returned from the Store callback.
```javascript
/**
@ -591,10 +599,10 @@ We'll need another public method, waitFor().
* @param {function} callback
*/
waitFor: function(promiseIndexes, callback) {
var selectedPromises = _promises.filter(function(/*object*/ _, /*number*/ j) {
return promiseIndexes.indexOf(j) !== -1;
var selectedPromises = promiseIndexes.map(function(index) {