Join Slack
Powered by
It’s possible to write such coroutine and it make ...
# coroutines
g
gildor
11/21/2017, 7:08 AM
It’s possible to write such coroutine and it make sense for some APIs like XmlHttpRequest (you can call abort()) but not for all of them (like Promises which doesn’t support cancellation, but you can just drop result for cancelled coroutine). you can check kotlinx.coroutines implementation:
https://github.com/Kotlin/kotlinx.coroutines/blob/master/core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/CancellableContinuation.kt
For JS you don’t need all those dispatching machinery, but you can use similar API with jobs
Open in Slack
Previous
Next