Timer Observable

Rocket.timerFunction
timer(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.

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)

close(source)
;

# output

[LogActor] Data: 2
[LogActor] Data: 3

See also: interval, TimerObservable, subscribe!, logger

source
Rocket.TimerObservableType
TimerObservable{Delay, Period}()

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

source