net / com.drake.net.scope / NetCoroutineScope
NetCoroutineScope¶
open class NetCoroutineScope :
AndroidScope
自动显示网络错误信息协程作用域
Constructors¶
Name | Summary |
---|---|
<init> | 自动显示网络错误信息协程作用域NetCoroutineScope(lifecycleOwner: LifecycleOwner? = null, lifeEvent: Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main) |
Properties¶
Name | Summary |
---|---|
animate | var animate: Boolean |
error | var error: Boolean |
isCacheSucceed | var isCacheSucceed: Boolean |
isReadCache | var isReadCache: Boolean |
preview | var preview: (suspend CoroutineScope.() -> Unit )? |
Functions¶
Name | Summary |
---|---|
cancel | open fun cancel(cause: CancellationException?): Unit |
catch | open fun catch(e: Throwable ): Unit |
finally | open fun finally(e: Throwable ?): Unit |
handleError | 错误处理open fun handleError(e: Throwable ): Unit |
launch | open fun launch(block: suspend CoroutineScope.() -> Unit ): NetCoroutineScope |
preview | "预览"作用域 该函数一般用于缓存读取, 只在第一次启动作用域时回调 该函数在作用域NetCoroutineScope.launch之前执行 函数内部所有的异常都不会被抛出, 也不会终止作用域执行fun preview(ignore: Boolean = false, animate: Boolean = false, block: suspend CoroutineScope.() -> Unit ): AndroidScope |
readCache | 读取缓存回调open fun readCache(succeed: Boolean ): Unit |
start | open fun start(): Unit |
Inheritors¶
Name | Summary |
---|---|
DialogCoroutineScope | 自动加载对话框网络请求class DialogCoroutineScope : NetCoroutineScope , LifecycleObserver |
PageCoroutineScope | class PageCoroutineScope : NetCoroutineScope |
StateCoroutineScope | 缺省页作用域class StateCoroutineScope : NetCoroutineScope |