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
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.[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.[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:
rx
.time.jsrx.lite.js
| rx.lite.compat.js
NPM Packages:
NuGet Packages:
Unit Tests: