
- RxJS Tutorial
- RxJS - Home
- RxJS - Overview
- RxJS - Environment Setup
- RxJS - Latest Updates
- RxJS - Observables
- RxJS - Operators
- RxJS - Working with Subscription
- RxJS - Working with Subjects
- RxJS - Working with Scheduler
- RxJS - Working with RxJS & Angular
- RxJS - Working with RxJS & ReactJS
- RxJS Useful Resources
- RxJS - Quick Guide
- RxJS - Useful Resources
- RxJS - Discussion
RxJS - Utility Operator observeOn
This operator based on the input scheduler will reemit the notifications from the source Observable.
Syntax
observeOn(scheduler): Observable
Parameters
scheduler − The scheduler is used as an input that will help to re-emit the notifications from the source observable.
Return value
It will return an observable same as source observable, but with scheduler param.
Example
import { interval } from 'rxjs'; import { observeOn } from 'rxjs/operators'; import { animationFrameScheduler } from 'rxjs'; let testDiv = document.getElementById("test"); const intervals = interval(100); let case1 = intervals.pipe( observeOn(animationFrameScheduler), ); let sub1 = case1.subscribe(val => { console.log(val); testDiv.style.height = val + 'px'; testDiv.style.width = val + 'px'; });
Output

Advertisements