跳至主要內容

Class: data_sharer<CT>

muzzik小于 1 分钟

index / data_sharer

Class: data_sharer<CT>

数据共享器

Remarks

用以模块间共享数据

  • 支持请求数据返回

Type parameters

NameType
CTany

Hierarchy

Table of contents

Properties

Methods

Properties

key

key: { [k in string | number | symbol]: k }

Defined in

assets/@framework/mk_data_sharer.ts:14open in new window

Methods

delete

delete<T>(key_): void

删除数据

Type parameters

NameType
Textends string | number | symbol

Parameters

NameTypeDescription
key_T注册键

Returns

void

Defined in

assets/@framework/mk_data_sharer.ts:28open in new window


set

set<T, T2>(key_, data_): void

设置数据

Type parameters

NameType
Textends string | number | symbol
T2CT[T]

Parameters

NameTypeDescription
key_T注册键
data_T2数据

Returns

void

Defined in

assets/@framework/mk_data_sharer.ts:47open in new window


get

get<T, T2>(key_): null | T2

获取数据

Type parameters

NameType
Textends string | number | symbol
T2CT[T]

Parameters

NameTypeDescription
key_T注册键

Returns

null | T2

Defined in

assets/@framework/mk_data_sharer.ts:65open in new window

get<T, T2, T3>(key_, request_): T2 extends true ? Promise<T3> : null | T3

获取数据

Type parameters

NameType
Textends string | number | symbol
T2extends boolean
T3CT[T]

Parameters

NameTypeDescription
key_T注册键
request_T2请求数据,若不存在则等待 set 后返回

Returns

T2 extends true ? Promise<T3> : null | T3

Defined in

assets/@framework/mk_data_sharer.ts:71open in new window


clear

clear(): void

清空

Returns

void

Defined in

assets/@framework/mk_data_sharer.ts:92open in new window

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