Package androidx.lifecycle

Functions

life
Link copied to clipboard
fun Interval.life(viewModel: ViewModel): <ERROR CLASS>
轮询器根据ViewModel生命周期自动取消
scopeLife
Link copied to clipboard
fun ViewModel.scopeLife(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit): AndroidScope
ViewModel被销毁时取消协程作用域
scopeNetLife
Link copied to clipboard
fun ViewModel.scopeNetLife(dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() -> Unit): NetCoroutineScope
ViewModel被销毁时取消协程作用域以及其中的网络请求 具备网络错误全局处理功能, 其内部的网络请求会跟随其作用域的生命周期