necati
07/02/2019, 5:48 PMObservable.interval(0, 1, TimeUnit.MINUTES)
When I leave the page, the task should be dismissed.
Any suggestions?louiscad
07/02/2019, 5:57 PMdelay
or flow { emit(delay(60_000)) }
are ways to do this I guess.Jag
07/03/2019, 3:50 AMfun <T> Flow<T>.interval(initialDelay: Long, period: Long, unit: TimeUnit = TimeUnit.MILLISECONDS) = flow {
coroutineScope {
delay(unit.toMillis(initialDelay))
var value = 0L
while (true) {
emit(value++)
delay(unit.toMillis(period))
}
}
}