Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.27 KB

interval.md

File metadata and controls

61 lines (48 loc) · 2.27 KB

Rx.Observable.interval(period, [scheduler])

Returns an observable sequence that produces a value after each period.

Arguments

  1. period (Number): Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
  2. [scheduler] (Scheduler=Rx.Scheduler.timeout): Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.

Returns

(Observable): An observable sequence that produces a value after each period.

Example

var source = Rx.Observable
    .interval(500 /* ms */)
    .timeInterval()
    .take(3);

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: {value: 0, interval: 500}
// => Next: {value: 1, interval: 500}
// => Next: {value: 2, interval: 500}
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: