Refactor ZenKeyboardShortcutsLoader to add a new method for removing shortcuts and update the resetAllShortcuts method to use it

This commit is contained in:
mauro-balades 2024-09-24 16:58:13 +02:00
parent 53b7f6eecc
commit 028c896112

View file

@ -493,6 +493,10 @@ class ZenKeyboardShortcutsLoader {
async load(withoutCache = false) {
return (await this.loadObject(withoutCache))?.shortcuts;
}
async remove() {
await IOUtils.remove(this.shortcutsFile);
}
}
function zenGetDefaultShortcuts() {
@ -777,6 +781,10 @@ var gZenKeyboardShortcutsManager = {
}
},
async resetAllShortcuts() {
await this.loader.remove();
},
async _saveShortcuts() {
let json = [];
for (shortcut of this._currentShortcutList) {