添加setAndSave方法作为设置参数并保存
This commit is contained in:
parent
f9ea1bec3f
commit
44d61785cf
1 changed files with 14 additions and 0 deletions
|
@ -80,6 +80,20 @@ export class SettingUtils {
|
||||||
this.updateElementFromValue(key);
|
this.updateElementFromValue(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Set and save setting item value
|
||||||
|
* If you want to set and save immediately you can use this method
|
||||||
|
* @param key key name
|
||||||
|
* @param value value
|
||||||
|
*/
|
||||||
|
async setAndSave(key: string, value: any) {
|
||||||
|
let item = this.settings.get(key);
|
||||||
|
if (item) {
|
||||||
|
item.value = value;
|
||||||
|
this.updateElementFromValue(key);
|
||||||
|
await this.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable setting item
|
* Disable setting item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue