# Package androidx.lifecycle

## Functions

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