gildor
02/14/2018, 8:22 AMval channel = produce {
delay(500) // only one value with delay, but can be wrapped to some loop)
send("some value")
}
for (value in channel) {
//Do something
}
Depends on your case of course. What exactly do you want to do?adibfara
02/14/2018, 8:31 AMObservable.interval
emits an item every x TimeUnits. for example you can emit a value every 500 miliseconds for 10 times.
From your code, I imagine it would be easy to implement, It just needs a for
for how many times it should run and the timer needs to be inside delay
.
Thanks.gildor
02/14/2018, 8:32 AMval channel = produce {
repeat(10) {
delay(500)
send("some value")
}
}
adibfara
02/14/2018, 8:34 AM