scope-net-life.md 606 B

net / com.drake.net.utils / androidx.fragment.app.Fragment / scopeNetLife

scopeNetLife

fun Fragment.scopeNetLife(lifeEvent: Event = Lifecycle.Event.ON_STOP, dispatcher: CoroutineDispatcher = Dispatchers.Main, block: suspend CoroutineScope.() ->Unit):NetCoroutineScope

Fragment应当在Lifecycle.Event.ON_STOP时就取消作用域, 避免Fragment.onDestroyView导致引用空视图