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

kirillrakhman

12/20/2016, 10:01 AM
is this a correct implementation for `await`ing an observable?
Copy code
fun <V> Observable<V>.subscribeWithContinuation(x: Continuation<V>) = subscribe(x::resume, x::resumeWithException)!!

suspend fun <V> Observable<V>.awaitFirst() : V = suspendCoroutine {
    first().subscribeWithContinuation(it)
}