loadSetting() support only key
This commit is contained in:
@ -9,7 +9,7 @@ export default class SettingMapper {
|
|||||||
|
|
||||||
private map = new Map<string, Ref<string>>();
|
private map = new Map<string, Ref<string>>();
|
||||||
|
|
||||||
public static async loadSetting(...settings: { key: string, args?: { [key: string]: any }}[]): Promise<void> {
|
public static async loadSetting(...settings: (string | { key: string, args?: { [key: string]: any }})[]): Promise<void> {
|
||||||
const map = new Map<string, object | undefined>();
|
const map = new Map<string, object | undefined>();
|
||||||
{
|
{
|
||||||
// 默认配置
|
// 默认配置
|
||||||
@ -34,7 +34,12 @@ export default class SettingMapper {
|
|||||||
{
|
{
|
||||||
// 附加配置
|
// 附加配置
|
||||||
for (let i = 0; i < settings.length; i++) {
|
for (let i = 0; i < settings.length; i++) {
|
||||||
map.set(settings[i].key, settings[i].args);
|
const setting = settings[i];
|
||||||
|
if (typeof setting === 'string') {
|
||||||
|
map.set(setting, undefined);
|
||||||
|
} else {
|
||||||
|
map.set(setting.key, setting.args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const instance = this.getInstance();
|
const instance = this.getInstance();
|
||||||
|
|||||||
Reference in New Issue
Block a user