In this section, we're going to implement our own dispatcher module. This will serve as a replacement for the Facebook reference implementation that we've relied upon so far in this book. First, we'll think about how the dispatcher will track references to store modules. Then, we'll discuss the functions that this module needs to expose, followed by a walk-through of the dispatch()
implementation. Lastly, we'll figure out how we want to handle dependency management with this dispatcher module.
The first aspect of our dispatcher module to consider are the stores themselves. With Facebook's reference implementation, there are no references to stores—only references to callback functions. That is, when we register with Facebook's dispatcher, we're passing the register()
method a function instead of the store instance itself. Our dispatcher module will hold onto store references instead of just callback functions. Here's a diagram that...