storage
声明 storage.maxBytes。二进制对象是插件私有的本机数据,跨 View 和应用重启保留。不存在的键读取为 null,写入受声明配额和宿主限制。
签名、参数及返回类型从 SDK 自动生成;可选成员不保证在每个宿主和上下文中存在。
PluginStorage
Section titled “PluginStorage”PluginStorage.list
Section titled “PluginStorage.list”支持宿主: Lite
列出存储对象,可按键前缀过滤。
list(prefix?: string): Promise<Array<{ key: string; size: number;}>>;| 参数 | 类型 | 必填 |
|---|---|---|
prefix |
string |
否 |
返回值: Promise<Array<{ key: string; size: number; }>>.
PluginStorage.read
Section titled “PluginStorage.read”支持宿主: Lite
读取对象字节,键不存在时返回 null。
read(key: string): Promise<Uint8Array | null>;| 参数 | 类型 | 必填 |
|---|---|---|
key |
string |
是 |
返回值: Promise<Uint8Array | null>.
PluginStorage.write
Section titled “PluginStorage.write”支持宿主: Lite
在插件存储配额内写入对象。
write(key: string, value: Uint8Array): Promise<void>;| 参数 | 类型 | 必填 |
|---|---|---|
key |
string |
是 |
value |
Uint8Array |
是 |
返回值: Promise<void>.
PluginStorage.delete
Section titled “PluginStorage.delete”支持宿主: Lite
删除私有存储对象。
delete(key: string): Promise<void>;| 参数 | 类型 | 必填 |
|---|---|---|
key |
string |
是 |
返回值: Promise<void>.