portal/src/jsMain/kotlin/de/kif/frontend/extensions.kt
2019-06-07 21:19:52 +02:00

14 lines
No EOL
457 B
Kotlin

package de.kif.frontend
import org.w3c.dom.*
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
fun launch(context: CoroutineContext = EmptyCoroutineContext, block: suspend () -> Unit) =
block.startCoroutine(Continuation(context) { result ->
result.onFailure { exception ->
console.error(exception)
}
})