Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.23 KB

interval.md

File metadata and controls

56 lines (42 loc) · 2.23 KB

interval

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

Emit numbers in sequence based on provided timeframe.

Ultimate RxJS

Examples

Example 1: Emit sequence of values at 1 second interval

( StackBlitz | jsBin | jsFiddle )

// RxJS v6+
import { interval } from 'rxjs';

//emit value in sequence every 1 second
const source = interval(1000);
//output: 0,1,2,3,4,5....
const subscribe = source.subscribe(val => console.log(val));

Related Recipes

Additional Resources


📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/interval.ts