This repository has been archived by the owner. It is now read-only.
Permalink
63 lines (49 sloc) 2.45 KB

This is RxJS v 4. Find the latest version here

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. Each value produced will default to a Number denoting its order in the timeline. (e.g. 0, 1, 2...)

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: