跳至主要內容

Class: monitor

muzzik大约 4 分钟

index / monitor

Class: monitor

数据监听器(类型安全)

Remarks

可以用以 mvvm 搭建及使用,注意:监听回调仅在下一帧被调用

Hierarchy

Table of contents

Methods

Methods

wait

wait<T, T2>(value_, key_): Promise<void>

等待监听回调执行完成

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T对象
key_T2

Returns

Promise<void>

Defined in

assets/@framework/mk_monitor.ts:116open in new window


on_recursion

on_recursion(value_, on_callback_f_, target_?): void

递归监听数据更新

Parameters

NameTypeDescription
value_any监听对象
on_callback_f_type_on_callback<any>on 触发回调
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:138open in new window

on_recursion(value_, on_callback_f_, off_callback_f_, target_?): void

递归监听数据更新

Parameters

NameTypeDescription
value_any监听对象
on_callback_f_type_on_callback<any>on 触发回调
off_callback_f_type_off_callbackoff 触发回调
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:146open in new window


on

on<T, T2>(value_, key_, on_callback_f_, target_?): null | type_on_callback<T[T2]>

监听数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
on_callback_f_type_on_callback<T[T2]>on 触发回调
target_?any绑定对象

Returns

null | type_on_callback<T[T2]>

Defined in

assets/@framework/mk_monitor.ts:181open in new window

on<T, T2>(value_, key_, on_callback_f_, off_callback_f_, target_?): null | type_on_callback<T[T2]>

监听数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
on_callback_f_type_on_callback<T[T2]>on 触发回调
off_callback_f_type_off_callbackoff 触发回调
target_?any绑定对象

Returns

null | type_on_callback<T[T2]>

Defined in

assets/@framework/mk_monitor.ts:195open in new window


once

once<T, T2>(value_, key_, on_callback_f_, target_?): null | type_on_callback<T[T2]>

监听单次数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
on_callback_f_type_on_callback<T[T2]>on 触发回调
target_?any绑定对象

Returns

null | type_on_callback<T[T2]>

Defined in

assets/@framework/mk_monitor.ts:226open in new window

once<T, T2>(value_, key_, on_callback_f_, off_callback_f_, target_?): null | type_on_callback<T[T2]>

监听单次数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
on_callback_f_type_on_callback<T[T2]>on 触发回调
off_callback_f_type_off_callbackoff 触发回调
target_?any绑定对象

Returns

null | type_on_callback<T[T2]>

Defined in

assets/@framework/mk_monitor.ts:240open in new window


off_recursion

off_recursion(value_, target_?): Promise<any>

递归取消监听数据更新

Parameters

NameTypeDescription
value_any监听对象
target_?any绑定目标

Returns

Promise<any>

Defined in

assets/@framework/mk_monitor.ts:270open in new window

off_recursion(value_, on_callback_f_, target_?): Promise<any>

递归取消监听数据更新

Parameters

NameTypeDescription
value_any监听对象
on_callback_f_type_on_callback<any>on 触发回调
target_?any绑定目标

Returns

Promise<any>

Defined in

assets/@framework/mk_monitor.ts:277open in new window


off

off<T, T2>(value_, key_, target_?): Promise<void>

取消监听数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
target_?any绑定目标

Returns

Promise<void>

Defined in

assets/@framework/mk_monitor.ts:317open in new window

off<T, T2>(value_, key_, on_callback_f_, target_?): Promise<void>

取消监听数据更新

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
on_callback_f_type_on_callback<T[T2]>on 触发回调
target_?any绑定目标

Returns

Promise<void>

Defined in

assets/@framework/mk_monitor.ts:325open in new window


clear

clear(target_): null | Promise<any[]>

清理对象绑定的数据

Parameters

NameTypeDescription
target_any绑定对象

Returns

null | Promise<any[]>

Defined in

assets/@framework/mk_monitor.ts:343open in new window


enable

enable(target_): void

启用 on 事件

Parameters

NameTypeDescription
target_any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:377open in new window

enable<T, T2>(value_, key_, target_?): void

启用 on 事件

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:384open in new window

enable<T, T2>(value_, key_, callback_f_, target_?): void

启用 on 事件

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
callback_f_type_on_callback<T[T2]>on 触发回调
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:392open in new window


disable

disable(target_): void

禁用 on 事件

Parameters

NameTypeDescription
target_any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:401open in new window

disable<T, T2>(value_, key_, target_?): void

禁用 on 事件

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:408open in new window

disable<T, T2>(value_, key_, callback_f_, target_?): void

禁用 on 事件

Type parameters

NameType
TT
T2extends string | number | symbol

Parameters

NameTypeDescription
value_T监听对象
key_T2监听键
callback_f_type_on_callback<T[T2]>on 触发回调
target_?any绑定对象

Returns

void

Defined in

assets/@framework/mk_monitor.ts:416open in new window

📣 觉得很赞?分享给你的朋友吧!