Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
62 lines (49 loc) · 2.45 KB

interval.md

File metadata and controls

62 lines (49 loc) · 2.45 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. 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: