Home > SYS_Storage > getExtensionUserConfig
SYS_Storage.getExtensionUserConfig() method
Get Extension user configuration
Signature
typescript
function getExtensionUserConfig(key: string): any | undefined;1
Parameters
Parameter | Type | Description |
|---|---|---|
key | string | Configuration item |
Returns
any | undefined
The value corresponding to the configuration item. undefined is returned if it does not exist
Remarks
Note: This API is only valid for extensions. Calling it in a standalone script environment will always throw Error
Example
javascript
// 1. 先写入一条演示配置
await eda.sys_Storage.setExtensionUserConfig('嘉立创示例_单位', 'mm');
// 2. 按 key 读取该配置
const value = eda.sys_Storage.getExtensionUserConfig('嘉立创示例_单位');
// 3. 读取不存在的 key,返回 undefined
const missing = eda.sys_Storage.getExtensionUserConfig('嘉立创示例_不存在的键');
// 4. 清理演示配置,还原存储现场
await eda.sys_Storage.deleteExtensionUserConfig('嘉立创示例_单位');
console.log('读取到的值:', value);
console.log('不存在的 key 返回:', missing);1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14