Learn RxJS
Search…
interval

signature: interval(period: number, scheduler: Scheduler): Observable

Emit numbers in sequence based on provided timeframe.

Examples

Example 1: Emit sequence of values at 1 second interval
1
// RxJS v6+
2
import { interval } from 'rxjs';
3
4
//emit value in sequence every 1 second
5
const source = interval(1000);
6
//output: 0,1,2,3,4,5....
7
const subscribe = source.subscribe(val => console.log(val));
Copied!

Additional Resources

Last modified 1yr ago