[RxJS] Asynchronous Execution Scheduler
microtask -> requestAnimationFrame -> macrotask
Each scheduler can just take callback as arguement
asyncScheduler.schedule(() => console.log('async')) // similar to setTimeout()
asapScheduler.schedule(() => console.log('microtask'))
animationFrameScheduler.scheduler(() => console.log('frame'))
queueScheduler.schedule(() => { // schedule additional task })
or
asyncScheduler.schedule(console.log, 200, 'async') // call console.log with 'async' after 200 ms
asapScheduler.schedule(console.log, null, 'microtask') // asapScheduler has no delay
animationFrameScheduler.schedule(console.log, null, 'aframe')
queueScheduler.schedule(() => {})
Scheduler as arguement
of(1,2,3 asyncScheduler).subscribe(observer);
observeOn operator
interval(20).pipe(
observeOn(animationFrameScheduler)
).subscribe(observer);
subscribeOn operator
of(1,2,3).pipe(
subscribeOn(asyncSchedulder)
).subscribe(observer)