This repository has been archived by the owner. It is now read-only.
Permalink
68 lines (54 sloc) 2.96 KB

This is RxJS v 4. Find the latest version here

Rx.Observable.timer(dueTime, [period], [scheduler])

Returns an observable sequence that produces a value after dueTime has elapsed and then after each period. Note for rx.lite.js, only relative time is supported.

Arguments

  1. dueTime (Date|Number): Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
  2. [period|scheduler=Rx.Scheduler.timeout] (Number|Scheduler): Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
  3. [scheduler=Rx.Scheduler.timeout] (Scheduler): Scheduler to run the timer on. If not specified, the timeout scheduler is used.

Returns

(Observable): An observable sequence that produces a value after due time has elapsed and then each period.

Example

var source = Rx.Observable.timer(200, 100)
    .timeInterval()
    .pluck('interval')
    .take(3);

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

// => Next: 200
// => Next: 100
// => Next: 100
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: