Adding EventEmitter

The two last bullets can really be condensed into one theme, namely eventing, or the ability to register to and fire off events.

So what does a cleanup of the store look like, and why would we need to clean it up? The reason for cleaning it up is it makes for simpler code. There is a standard library that is often used when constructing a store, called EventEmitter. The library handles just what we mentioned previously, namely it is able to register and fire off events. It is a simple implementation of the pub-sub pattern. Basically, EventEmitter allows you to subscribe to certain events and also allows you to trigger events. For more information on the pattern itself, have a look at the following link: https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.