Timer Observable
Rocket.timer
— Functiontimer(delay::Int)
timer(delay::Int, period::Int)
Creation operator for the TimerObservable
. Its like interval
(@ref), but you can specify when should the emissions start. timer
returns an Observable that emits an infinite sequence of ascending integers, with a constant interval of time, period of your choosing between those emissions. The first emission happens after the specified delay
. If period
is not specified, the output Observable emits only one value, 0. Otherwise, it emits an infinite sequence. The timer closes automatically when the unsubscription happens.
Arguments
delay
: the initial delay time specified as an integer denoting milliseconds to wait before emitting the first value of 0.period
: the minimum period of time between emissions of the subsequent numbers (in milliseconds).
Examples
using Rocket
source = timer(0, 50)
sleep(0.075)
subscription = subscribe!(source, logger())
sleep(0.105)
unsubscribe!(subscription)
;
# output
[LogActor] Data: 2
[LogActor] Data: 3
See also: interval
, TimerObservable
, subscribe!
, logger
Rocket.TimerObservable
— TypeTimerObservable
An Observable that starts emitting after an delay
and emits ever increasing numbers after each period
of time thereafter.
Parameters
delay
: The initial delay time specified as an integer denoting milliseconds to wait before emitting the first value of 0`.period
: The minimum period of time in milliseconds between emissions of the subsequent numbers.
See also: timer
, Subscribable