lazyField |
延迟初始化 线程安全 等效于lazy, 但是可以获取委托字段属性fun <T, V> T.lazyField(block: T.( KProperty <*>) -> V): ReadWriteProperty <T, V> |
runMain |
在主线程运行fun runMain(block: () -> Unit ): Unit |
scope |
异步作用域fun scope(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): AndroidScope |
scopeLife |
fun LifecycleOwner.scopeLife(lifeEvent: Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): AndroidScope |
scopeNet |
该函数比scope多了以下功能fun scopeNet(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |
scopeNetLife |
该函数比scopeNet多了自动取消作用域功能fun LifecycleOwner.scopeNetLife(lifeEvent: Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |
withDefault |
切换到默认调度器suspend fun <T> withDefault(block: suspend CoroutineScope.() -> T): T |
withIO |
切换到IO程调度器suspend fun <T> withIO(block: suspend CoroutineScope.() -> T): T |
withMain |
切换到主线程调度器suspend fun <T> withMain(block: suspend CoroutineScope.() -> T): T |
withUnconfined |
切换到没有限制的调度器suspend fun <T> withUnconfined(block: suspend CoroutineScope.() -> T): T |