Namespace<T extends NameSpaceContent<keyof T>>
⚠️
此页面正在建设中
⚠️
测试功能,可能会发生变化
Namespace 是一个类,表示 Storable 的命名空间。
公共属性
name
string
- 命名空间的可读名称
公共方法
constructor
name: string
- 命名空间的可读名称initContent: T
- 命名空间的初始内容key?: string
- 命名空间的键,默认为名称
set<Key extends keyof T>
示例:
const namespace = new Namespace<{name: string}>('player1', {name: 'John Doe'});
namespace.set('name', 'Jane Smith');
key: Key
- 要设置的值的键value: T[Key]
- 要设置的值- 返回
this
get<Key extends keyof T = any>
key: Key
- 要获取的值的键- 返回
T[Key]
equals<Key extends keyof T = any>
key: Key
- 要比较的值的键value: T[Key]
- 要比较的值- 返回
boolean
assign
values: Partial<T>
- 要分配的内容- 返回
this