interval

연산자(operator) 정의: 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

( jsBin | jsFiddle )

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

Additional Resources


:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/observable/IntervalObservable.ts

results matching ""

    No results matching ""