# AndroidScope

open class AndroidScope(lifecycleOwner: LifecycleOwner?, lifeEvent: Lifecycle.Event, dispatcher: CoroutineDispatcher) : CoroutineScope, Closeable
Content copied to clipboard

异步协程作用域

## Parameters

lifecycleOwner

生命周期持有者

lifeEvent

生命周期事件, 默认为Lifecycle.Event.ON_DESTROY下取消协程作用域

## Constructors

AndroidScope
Link copied to clipboard
fun AndroidScope(lifecycleOwner: LifecycleOwner? = null, lifeEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY, dispatcher: CoroutineDispatcher = Dispatchers.Main)
Content copied to clipboard
生命周期持有者

## Functions

cancel
Link copied to clipboard
open fun cancel(cause: <ERROR CLASS>? = null)
Content copied to clipboard
open fun cancel(message: String, cause: Throwable? = null)
Content copied to clipboard
catch
Link copied to clipboard
open fun catch(block: AndroidScope.(Throwable) -> Unit = {}): AndroidScope
Content copied to clipboard
当作用域内发生异常时回调
close
Link copied to clipboard
open override fun close()
Content copied to clipboard
finally
Link copied to clipboard
open fun finally(block: AndroidScope.(Throwable?) -> Unit = {}): AndroidScope
Content copied to clipboard
无论正常或者异常结束都将最终执行
handleError
Link copied to clipboard
open fun handleError(e: Throwable)
Content copied to clipboard
错误处理
launch
Link copied to clipboard
open fun launch(block: suspend CoroutineScope.() -> Unit): AndroidScope
Content copied to clipboard

## Properties

coroutineContext
Link copied to clipboard
open override val coroutineContext: CoroutineContext
Content copied to clipboard
dispatcher
Link copied to clipboard
val dispatcher: CoroutineDispatcher
Content copied to clipboard
scopeGroup
Link copied to clipboard
val scopeGroup: <ERROR CLASS>
Content copied to clipboard

## Inheritors

NetCoroutineScope
Link copied to clipboard