This commit is contained in:
Horis
2025-04-14 12:46:06 +08:00
parent cacffd18c4
commit 454341f835
7 changed files with 151 additions and 38 deletions
@@ -11,6 +11,12 @@ import kotlin.coroutines.ContinuationInterceptor
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.coroutineContext
val rhinoContext: RhinoContext
get() = Context.getCurrentContext() as RhinoContext
val rhinoContextOrNull: RhinoContext?
get() = Context.getCurrentContext() as? RhinoContext
@Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
@OptIn(ExperimentalContracts::class)
inline fun <T> suspendContinuation(crossinline block: suspend CoroutineScope.() -> T): T {