NetCoroutineScope

open class NetCoroutineScope(lifecycleOwner: LifecycleOwner?, lifeEvent: Lifecycle.Event, dispatcher: CoroutineDispatcher) : AndroidScope

自动显示网络错误信息协程作用域

Constructors

NetCoroutineScope
Link copied to clipboard
fun NetCoroutineScope(lifecycleOwner: LifecycleOwner? = null, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main)

Functions

cancel
Link copied to clipboard
open override fun cancel(cause: CancellationException?)
open fun cancel(message: String, cause: Throwable? = null)
catch
Link copied to clipboard
open fun catch(block: AndroidScope.(Throwable) -> Unit = {}): AndroidScope
当作用域内发生异常时回调
close
Link copied to clipboard
open override fun close()
finally
Link copied to clipboard
open fun finally(block: AndroidScope.(Throwable?) -> Unit = {}): AndroidScope
无论正常或者异常结束都将最终执行
handleError
Link copied to clipboard
open override fun handleError(e: Throwable)
错误处理
launch
Link copied to clipboard
open override fun launch(block: suspend CoroutineScope.() -> Unit): NetCoroutineScope
preview
Link copied to clipboard
fun preview(ignore: Boolean = false, animate: Boolean = false, block: suspend CoroutineScope.() -> Unit): AndroidScope
"预览"作用域 该函数一般用于缓存读取, 只在第一次启动作用域时回调 该函数在作用域NetCoroutineScope.launch之前执行 函数内部所有的异常都不会被抛出, 也不会终止作用域执行

Properties

animate
Link copied to clipboard
var animate: Boolean = false
coroutineContext
Link copied to clipboard
open override val coroutineContext: CoroutineContext
dispatcher
Link copied to clipboard
val dispatcher: CoroutineDispatcher
scopeGroup
Link copied to clipboard
val scopeGroup: CoroutineExceptionHandler

Inheritors

DialogCoroutineScope
Link copied to clipboard
PageCoroutineScope
Link copied to clipboard
StateCoroutineScope
Link copied to clipboard