Observables
In the previous chapter, we created Observables from the scratch and subscribed to those Observables. In all of our examples, the Observables created an instance of the (data)  Producer
class. The Producer
class produces an event Stream. In other words, Observables are functions that connect Subscribers (Observers) to Producers.
Â
Â
Before we proceed, let's dissect an Observable and the core activities related to it:
- An Observable is a function that takes an Observer as a parameter and returns a function
- An Observable connects an Observer to a Producer (Producer is opaque to the Observer)
- A Producer is a source of values for an Observable
- An Observer is an object that has the
on_next
,on_error
, andon_completed
methods
What's a Producer?
In a nutshell,A Producer is a source of value for an Observable. Producers can be GUI windows, Timers, WebSockets, DOM trees, Iterators over collections/containers, and so on. They can be anything that can be a source of values that can be passed...