Home > SYS_Storage > setExtensionUserConfig
SYS_Storage.setExtensionUserConfig() method
Set Extension user configuration
Signature
typescript
function setExtensionUserConfig(key: string, value: any): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
key | string | Configuration item |
value | any | Value |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
This API is also used to create a new extension user configuration. If it does not exist when setting, it will be created automatically
Note: This API is only valid for extensions. Calling it in a standalone script environment will always throw Error
Example
javascript
// 1. 写入一条新配置(key 不存在时自动新建)
const created = await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_主题', '深色');
// 2. 用同一个 key 再次写入,覆盖旧值
const updated = await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_主题', '浅色');
// 3. 清理演示配置,还原存储现场
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_主题');
console.log('新建配置结果:', created);
console.log('覆盖写入结果:', updated);1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11