Home

Events and dispatchers (like Facebook Flux)

Events are used to observe the behaviour of the user, e.g. clicks, keyboard input etc. They can also be used to communicate between different JavaScript Objects. Here is an example of how events can be used: Custom Events

NOTE: I must admit that I was hoping that `Object.observe` would become widespread. This will not happen since it now has been withdrawn.

Flux from Facebook is a nice approach for propagating information. It is a kind of pub/sub but all subcribers receive all events. There is also a mechanism for one subscriber to wait for others subscribers to process the event first. Implementing a dispatcher is relatively simple, here is a example. And here is another example where it also is possible to wait for other subscribers.