Skip to content

Commit c580fb7

Browse files
committed
update setting utils
1 parent e2ed032 commit c580fb7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/libs/setting-utils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class SettingUtils {
1717
settings: Map<string, ISettingItem> = new Map();
1818
elements: Map<string, HTMLElement> = new Map();
1919

20-
constructor(plugin: Plugin, name?: string, width?: string, height?: string) {
20+
constructor(plugin: Plugin, name?: string, width?: string, height?: string, callback?: (data: any) => void) {
2121
this.name = name ?? 'settings';
2222
this.plugin = plugin;
2323
this.file = this.name.endsWith('.json') ? this.name : `${this.name}.json`;
@@ -29,8 +29,12 @@ export class SettingUtils {
2929
this.updateValue(key);
3030
}
3131
let data = this.dump();
32-
this.plugin.data[this.name] = data;
33-
this.save();
32+
if (callback !== undefined) {
33+
callback(data);
34+
} else {
35+
this.plugin.data[this.name] = data;
36+
this.save();
37+
}
3438
}
3539
});
3640
}

0 commit comments

Comments
 (0)