net / com.drake.net.scope / AndroidScope
AndroidScope¶
open class AndroidScope : CoroutineScope
异步协程作用域
Constructors¶
Name | Summary |
---|---|
<init> | 异步协程作用域AndroidScope(lifecycleOwner: LifecycleOwner? = null, lifeEvent: Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main) |
Properties¶
Name | Summary |
---|---|
catch | var catch: ( AndroidScope .( Throwable ) -> Unit )? |
coroutineContext | open val coroutineContext: CoroutineContext |
dispatcher | val dispatcher: CoroutineDispatcher |
finally | var finally: ( AndroidScope .( Throwable ?) -> Unit )? |
uid | val uid: CoroutineExceptionHandler |
Functions¶
Name | Summary |
---|---|
cancel | open fun cancel(cause: CancellationException? = null): Unit open fun cancel(message: String , cause: Throwable ? = null): Unit |
catch | open fun catch(e: Throwable ): Unit 当作用域内发生异常时回调 open fun catch(block: AndroidScope .( Throwable ) -> Unit = {}): AndroidScope |
finally | open fun finally(e: Throwable ?): Unit 无论正常或者异常结束都将最终执行 open fun finally(block: AndroidScope .( Throwable ?) -> Unit = {}): AndroidScope |
handleError | 错误处理open fun handleError(e: Throwable ): Unit |
launch | open fun launch(block: suspend CoroutineScope.() -> Unit ): AndroidScope |
Inheritors¶
Name | Summary |
---|---|
NetCoroutineScope | 自动显示网络错误信息协程作用域open class NetCoroutineScope : AndroidScope |