Class: life_cycle
index / life_cycle
Class: life_cycle
生命周期
Remarks
用于模块生命周期控制,注意所有生命周期函数 onLoad、open ... 等都会自动执行父类函数再执行子类函数,不必手动 super.xxx 调用
open 顺序: 子 -> 父
close 顺序: 父 -> 子
Hierarchy
↳
life_cycle
↳↳
node
↳↳
scene_drive
↳↳
view_base
Implements
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new life_cycle(...args
)
Parameters
Name | Type |
---|---|
...args | any [] |
Overrides
mk_layer.constructor
Defined in
assets/@framework/module/mk_life_cycle.ts:84
Properties
init_data
• Optional
init_data: any
初始化数据
Defined in
assets/@framework/module/mk_life_cycle.ts:120
event_target_as
• Readonly
event_target_as: { targetOff
: (target
: any
) => any
}[] | { target_off
: (target
: any
) => any
}[] = []
事件对象列表
Remarks
模块关闭后自动清理事件
Defined in
assets/@framework/module/mk_life_cycle.ts:127
_static_b
• Protected
_static_b: boolean
= true
静态模块
Defined in
assets/@framework/module/mk_life_cycle.ts:158
_load_task
• Protected
_load_task: status
<void
>
load任务
Defined in
assets/@framework/module/mk_life_cycle.ts:160
_open_task
• Protected
_open_task: status
<void
>
open任务
Defined in
assets/@framework/module/mk_life_cycle.ts:162
_state
• Protected
_state: run_state
= _mk_life_cycle.run_state.close
运行状态
Defined in
assets/@framework/module/mk_life_cycle.ts:164
Accessors
valid_b
• get
valid_b(): boolean
有效状态
Returns
boolean
Remarks
表示模块未在(关闭/关闭中)状态
Defined in
assets/@framework/module/mk_life_cycle.ts:134
static_b
• get
static_b(): boolean
静态模块
Returns
boolean
Defined in
assets/@framework/module/mk_life_cycle.ts:145
config
• set
config(config_
): void
设置模块配置
Parameters
Name | Type |
---|---|
config_ | create_config |
Returns
void
Defined in
assets/@framework/module/mk_life_cycle.ts:150
_log
• Protected
get
_log(): logger
日志
Returns
Defined in
assets/@framework/module/mk_life_cycle.ts:172
Methods
onLoad
▸ Protected
onLoad(): void
Returns
void
Overrides
Defined in
assets/@framework/module/mk_life_cycle.ts:180
create
▸ Protected
Optional
create(): void
| Promise
<void
>
创建
Returns
void
| Promise
<void
>
Remarks
可在此处初始化视图状态
静态模块:onLoad 时调用
动态模块:addChild 后调用
Defined in
assets/@framework/module/mk_life_cycle.ts:204
init
▸ init(data_?
): void
| Promise
<void
>
初始化
Parameters
Name | Type | Description |
---|---|---|
data_? | any | 初始化数据 |
Returns
void
| Promise
<void
>
Remarks
所有依赖 init_data 初始化的逻辑都应在此进行
静态模块:外部自行调用,常用于更新 item 或者静态模块
动态模块:onLoad 后,open 前调用
Defined in
assets/@framework/module/mk_life_cycle.ts:217
open
▸ Protected
Optional
open(): void
| Promise
<void
>
打开
Returns
void
| Promise
<void
>
Remarks
init 后执行,在此处执行无需 init_data 支持的模块初始化操作
Defined in
assets/@framework/module/mk_life_cycle.ts:230
close
▸ Optional
close(): void
| Promise
<void
>
关闭
Returns
void
| Promise
<void
>
Remarks
内部调用:生命周期
外部调用:自动回收模块
Defined in
assets/@framework/module/mk_life_cycle.ts:238
late_close
▸ Protected
Optional
late_close(): void
| Promise
<void
>
关闭后
Returns
void
| Promise
<void
>
Remarks
在子模块 close 和 late_close 后执行
Defined in
assets/@framework/module/mk_life_cycle.ts:247
follow_release
▸ follow_release<T
>(object_
): T
Type parameters
Name | Type |
---|---|
T | Object |
Parameters
Name | Type |
---|---|
object_ | T |
Returns
T
Implementation of
mk_asset_.follow_release_object.follow_release
Defined in
assets/@framework/module/mk_life_cycle.ts:267
cancel_release
▸ cancel_release<T
>(object_
): T
Type parameters
Name | Type |
---|---|
T | Object |
Parameters
Name | Type |
---|---|
object_ | T |
Returns
T
Implementation of
mk_asset_.follow_release_object.cancel_release