fromEvent() operator

Now it gets really interesting. The fromEvent() operator allows us to mix a UI event such as a click or a scroll event and turn it into a stream. So far, we have operated under the assumption that asynchronous calls is something that only has to do with AJAX calls. This is far from true. The fact that we can mix UI events with any type of asynchronous calls creates a really interesting situation that allows us to compose really powerful, expressive code. We will touch on this topic further in the coming section, Thinking in streams.

To use this operator, you need to provide it with two arguments: a DOM element and the name of an event, like so:

// creation-operators/fromEvent.js// we imagine we have an element in our ...

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.