June 2025
Intermediate to advanced
837 pages
24h 50m
English
Schedulers affect the time at which the events of an observable are triggered. Different schedulers also create a different effect in your application. The effect of the different schedulers provided by RxJS is easiest to demonstrate with an actual example. Listing 17.29 contains three observables, each of which has been provided with different schedulers.
import { observeOn } from 'rxjs/operators';import { of, queueScheduler, asapScheduler, asyncScheduler } from 'rxjs'; console.log('start');of('queueScheduler') .pipe(observeOn(queueScheduler)) .subscribe((data) => console.log(data));of('asyncScheduler') .pipe(observeOn(asyncScheduler)) .subscribe((data) => console.log(data));of('asapScheduler') .pipe(observeOn(asapScheduler) ...
Read now
Unlock full access