2020-02-03 04:22:54 +01:00
|
|
|
package eu.kanade.tachiyomi.util.lang
|
2017-10-13 00:12:29 +02:00
|
|
|
|
2019-09-19 04:45:54 +02:00
|
|
|
import kotlinx.coroutines.*
|
2017-10-13 00:12:29 +02:00
|
|
|
|
|
|
|
fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
|
2019-09-18 23:41:09 +02:00
|
|
|
GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, block)
|
2017-10-13 00:12:29 +02:00
|
|
|
|
2020-02-04 01:11:18 +01:00
|
|
|
fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
|
|
|
|
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
|
|
|
|
|
2019-09-19 04:45:54 +02:00
|
|
|
@UseExperimental(ExperimentalCoroutinesApi::class)
|
2017-10-13 00:12:29 +02:00
|
|
|
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
|
2019-09-18 23:41:09 +02:00
|
|
|
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
|