jsTest.RunTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of websocket Show documentation
Show all versions of websocket Show documentation
Simple multiplatform kotlin coroutines based websocket.
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.promise
import kotlin.js.Promise
actual fun block(body: suspend CoroutineScope.() -> T): dynamic = runTestInternal(block = body)
fun runTestInternal(
block: suspend CoroutineScope.() -> T
): Promise {
val promise = GlobalScope.promise {
return@promise block()
}
return promise
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy