January 2019
Beginner
210 pages
4h 47m
English
We can create an observable given a value using the of function. In the old versions of RxJS, the function of was a static method of the Observable class, which was available as Observable.of. This should remind us to use the of method of the Applicative type in category theory because observables take some inspiration from category theory. However, in RxJS 6.0, the of method is available as a standalone factory function:
import { of } from "rxjs";const observable = of(1);const subscription = observable.subscribe( (value) => console.log(value), (error: any) => console.log(error), () => console.log("Done!"));subscription.unsubscribe();
The preceding code snippet declares an observable with one unique value ...
Read now
Unlock full access