https://kotlinlang.org logo
#coroutines
Title
# coroutines
o

otakusenpai

10/17/2018, 9:00 PM
Hello how could I make a function repeatable after a period of time using coroutines?
s

Seri

10/17/2018, 9:02 PM
Do you want the function to repeat itself on a timer, or to filter calls faster than a certain period?
o

otakusenpai

10/17/2018, 9:02 PM
on a timer
o

otakusenpai

10/17/2018, 9:06 PM
how could i set the time period to execute after? Suppose i hav a function foo() and want to excute foo() after 40s and this call does some kind of i/o
e

enleur

10/17/2018, 9:08 PM
create a ticker channel that will emit message after 40s and then close the channel
o

otakusenpai

10/17/2018, 9:27 PM
Copy code
suspend fun CoroutineScope.updateChannelList()  { 
        
}
This is the function signature that I have as of now. But the signature expected by withTimeoutOrNull is different. Can you give a sample ?
Is sending to a ticker channel only one time procedure or should it be done multiple times?
5 Views