suspendFunction

suspend fun suspendFunction(target: JsObject, name: String, arity: Int = 0, scope: CoroutineScope, body: suspend (List<JsValue>) -> Any?): JsFunction

Binds a host function that suspends. The script sees a normal function returning a promise; body runs on scope and settles it.