Delay Operator
Rocket.delay
— Functiondelay(delay::Int)
Creates a delay operator, which delays the emission of items from the source Observable by a given timeout.
Arguments:
delay::Int
: the delay duration in milliseconds (a number) until which the emission of the source items is delayed.
Producing
Stream of type <: Subscribable{L}
where L
refers to type of source stream
See also: AbstractOperator
, InferableOperator
, ProxyObservable
Description
Delays the emission of items from the source Observable by a given timeout
Example
Delay every value with 1 second to the output
using Rocket
using Dates
source = from([ 1, 2, 3 ])
println(Dates.format(now(), "MM:SS"))
subscription = subscribe!(source |> delay(2000), lambda(
on_next = (d) -> println("$(Dates.format(now(), "MM:SS")): $d")
));
# output
03:41
03:43: 1
03:43: 2
03:43: 3