Closed AAkira closed 3 years ago
closes #56, #69
You can use this library on a background thread on iOS using Kotlin.coroutines as native-mt.
internal val mainScope = SharedScope(Dispatchers.Main) internal val backgroundScope = SharedScope(Dispatchers.Default) internal class SharedScope(private val context: CoroutineContext) : CoroutineScope { private val job = Job() private val exceptionHandler = CoroutineExceptionHandler { _, throwable -> println("[Coroutine Exception] $throwable") } override val coroutineContext: CoroutineContext get() = context + job + exceptionHandler }
backgroundScope.launch { suspendFunction() }
closes #56, #69
Run background thread
You can use this library on a background thread on iOS using Kotlin.coroutines as native-mt.