January 2019
Beginner
210 pages
4h 47m
English
It is also possible to create an observable using an event as the source of the items in the stream. We can do this using the fromEvent function:
import { fromEvent } from "rxjs";const observable = fromEvent(document, "click");const subscription = observable.subscribe( (value) => console.log(value));subscription.unsubscribe();
In this case, the item handler in the subscription will be invoked as many times as the click event takes place.
Read now
Unlock full access