This is RxJS v 4. Find the latest version here
Records the time interval between consecutive values in an observable sequence.
[scheduler=Rx.Observable.timeout]
(Scheduler
): Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
(Observable
): An observable sequence with time interval information on values.
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
File:
Dist:
Prerequisites:
- If using
rx.time.js
NPM Packages:
NuGet Packages:
Unit Tests: