Class: Lifecycle

生命周期管理器

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Lifecycle(parent?)

创建一个生命周期管理器

Parameters

Name Type Description
parent? null | Lifecycle 父级生命周期管理器

Properties

_disposed

Private _disposed: any


_parent

Private Readonly _parent: any


dispose

dispose: () => void

Type declaration

(): void

销毁该实例,触发所有销毁监听器

Returns

void


disposePromise

Private Readonly disposePromise: any


eventEmitter

Private eventEmitter: any

Accessors

asPromise

get asPromise(): Promise<void>

获取销毁时机的 Promise

Returns

Promise<void>


disposed

get disposed(): boolean

是否已经销毁

Returns

boolean

Methods

addDisposeListener

addDisposeListener(listener): void

添加销毁监听器

Parameters

Name Type Description
listener () => void 监听器

Returns

void


removeDisposeListener

removeDisposeListener(listener): void

移除销毁监听器

Parameters

Name Type Description
listener () => void 监听器

Returns

void