Join Slack
And also an `interval` function that isn’t as terrible as this one I just wrote:
# multiplatform
p
pardom
02/20/2019, 5:00 PM
And also an
interval
function that isn’t as terrible as this one I just wrote:
Untitled.kt
s
sitepodmatt
02/21/2019, 6:57 AM
Drop the GlobalScope by changing signature to fun CoroutineScope.interval(... and then just use this.launch (this is redundant but noted to make clearer).
sitepodmatt
02/21/2019, 6:58 AM
use val timeTaken = measureTimeMillis { block() }
sitepodmatt
02/21/2019, 6:58 AM
swap delay and block()
sitepodmatt
02/21/2019, 6:58 AM
use delay(period - timeTaken)
3
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by