Of Observers and Iterators
To understand where Observables come from we need to look at their foundations: the Observer and Iterator software patterns. In this section we’ll take a quick look at them, and then we’ll see how Observables combine concepts of both in a simple but powerful way.
The Observer Pattern
For a software developer, it’s hard to hear about Observables and not think of the venerable Observer pattern. In it we have an object called Producer that keeps an internal list of Listeners subscribed to it. Listeners are notified—by calling their update method—whenever the state of the Producer changes. (In most explanations of the Observer pattern, this entity is called Subject, but to avoid confusion with RxJS’s own Subject type, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access