Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.38 KB

timeinterval.md

File metadata and controls

62 lines (49 loc) · 2.38 KB

Rx.Observable.prototype.timeInterval([scheduler])

Records the time interval between consecutive values in an observable sequence.

Arguments

  1. [scheduler=Rx.Observable.timeout] (Scheduler): Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.

Returns

(Observable): An observable sequence with time interval information on values.

Example

var source = Rx.Observable.timer(0, 1000)
    .timeInterval()
    .map(function (x) { return x.value + ':' + x.interval; })
    .take(5);

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

// => Next: 0:0
// => Next: 1:1000
// => Next: 2:1000
// => Next: 3:1000
// => Next: 4:1000
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: