Observable factory methods
The as_observable method uses one of the factory methods of the Observable class to create an observable sequence. This sequence is backed up by what is functionally a generator, although it's not implemented as one because that concept doesn't exist in every language that Rx is portable to.
So, instead of a real generator, we're providing it with a state variable, which in this case is just the animal instance, along with functions it could call to check whether the sequences continue, update the state, get the next value in the sequence, or determine how long to wait before producing the next value. The factory method also accepts a scheduler object, which we'll discuss later in this section. So, what we're asking ...
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