
- 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 timeInterval
This operator will return an object which contains current value and the time elapsed between the current and previous value that is calculated using scheduler input taken.
Syntax
timeInterval(scheduler): Observable
Parameters
scheduler − (optional) The scheduler input is used to calculate the time elapsed between the current and previous value from source Observable.
Return value
It will return an observable that will have source values and also the time interval.
Example
import { of } from 'rxjs'; import { filter, timeInterval } from 'rxjs/operators'; let list1 = of(2, 3, 4, 5, 6); let final_val = list1.pipe(timeInterval()); final_val.subscribe(x => console.log(x));
Output

Advertisements