The Timer operator creates an Observable that emits one particular item after a span of time that you specify.
TBD
TBD
RxGroovy implements this operator as timer
.
timer
returns an Observable that emits a single number zero after a delay period you specify.
timer
by default operates on the computation
Scheduler, or you can override this by passing in a Scheduler as a final
parameter.
timer(long,TimeUnit)
timer(long,TimeUnit,Scheduler)
RxJava implements this operator as timer
.
timer
returns an Observable that emits a single number zero after a delay period you specify.
timer
by default operates on the computation
Scheduler, or you can override this by passing in a Scheduler as a final
parameter.
timer(long,TimeUnit)
timer(long,TimeUnit,Scheduler)
In RxJS there are two versions of the timer
operator.
The first version of timer
returns an Observable that emits a single item
after a delay period you specify. You can specify the delay either as a Date
object (which means, delay until that absolute moment) or as an integer (which means, delay
that many milliseconds).
There is also a version of timer
that returns an Observable that emits a single
item after a specified delay, and then emits items periodically thereafter on a specified
periodicity. In this way it behaves a bit more like the
Interval operator.
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
timer
by default operates on the timeout
Scheduler, or you can override this by passing in a Scheduler as a final
parameter.
timer
is found in each of the following distributions:
rx.all.js
rx.all.compat.js
rx.time.js
(requires either rx.js
or rx.compat.js
)rx.lite.js
rx.lite.compat.js
TBD
RxPHP implements this operator as timer
.
Returns an observable sequence that produces a value after dueTime has elapsed.
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/timer/timer.php $loop = new \React\EventLoop\StreamSelectLoop(); $scheduler = new \Rx\Scheduler\EventLoopScheduler($loop); $source = \Rx\Observable::timer(200, $scheduler); $source->subscribe($createStdoutObserver()); $loop->run();
Next value: 0 Complete!
TBD
TBD
TBD
TBD