antoin_m
10/17/2018, 1:59 PMlouiscad
10/17/2018, 2:01 PMantoin_m
10/17/2018, 2:03 PMlouiscad
10/17/2018, 2:04 PMget
but the callback equivalent I think. Look at kotlinx.coroutines repo in the integration directoryantoin_m
10/17/2018, 2:08 PMJonathan
10/17/2018, 2:48 PMfun callbackFunction(callback: (String) -> Unit) {
timer(period = 2000) { callback("Hello world") }
}
suspend fun suspendingUsage(): String {
return suspendCoroutine { continuation ->
callbackFunction { result ->
continuation.resume(result)
}
}
}