The Interval operator returns an Observable that emits an infinite sequence of ascending integers, with a constant interval of time of your choosing between emissions.
See AlsoRxGroovy implements this operator as interval
. It accepts as its parameters a span of time to wait between emissions and the TimeUnit
in which this span is measured.
interval(long,TimeUnit)
interval(long,TimeUnit,Scheduler)
There is also a version of interval
that returns an Observable that emits a single zero after a specified delay, and then emits incrementally increasing numbers periodically thereafter on a specified periodicity. This version of interval
was called timer
in RxGroovy 1.0.0, but that method has since been deprecated in favor of the one named interval
with the same behavior.
interval(long,long,TimeUnit)
interval(long,long,TimeUnit,Scheduler)
interval
operates by default on the computation
Scheduler. There are also variants that allow you to set the Scheduler by passing one in as a parameter.
RxJava implements this operator as interval
. It accepts as its parameters a span of time to wait between emissions and the TimeUnit
in which this span is measured.
interval(long,TimeUnit)
interval(long,TimeUnit,Scheduler)
There is also a version of interval
that returns an Observable that emits a single zero after a specified delay, and then emits incrementally increasing numbers periodically thereafter on a specified periodicity. This version of interval
was called timer
in RxJava 1.0.0, but that method has since been deprecated in favor of the one named interval
with the same behavior.
interval(long,long,TimeUnit)
interval(long,long,TimeUnit,Scheduler)
interval
operates by default on the computation
Scheduler. There are also variants that allow you to set the Scheduler by passing one in as a parameter.
RxJS implements this operator as interval
. It accepts as its parameter the number of milliseconds to wait between emissions.
interval
operates by default on the timeout
Scheduler, or you can optionally pass in a different Scheduler as a second parameter, and interval
will operate on that Scheduler instead.
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
interval
is found in the following distributions:
rx.lite.js
rx.lite.compat.js
rx.timejs
(requires rx.js
or rx.compat.js
)RxPHP implements this operator as interval
.
Returns an Observable that emits an infinite sequence of ascending integers starting at 0, with a constant interval of time of your choosing between emissions.
Sample Code//from https://github.com/ReactiveX/RxPHP/blob/master/demo/interval/interval.php \Rx\Observable::interval(1000) ->take(5) ->subscribe($createStdoutObserver());
Next value: 0 Next value: 1 Next value: 2 Next value: 3 Next value: 4 Complete!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4