From 028c89611269da6a27df0183b2021e7617788f1b Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Tue, 24 Sep 2024 16:58:13 +0200 Subject: [PATCH] Refactor ZenKeyboardShortcutsLoader to add a new method for removing shortcuts and update the resetAllShortcuts method to use it --- src/ZenKeyboardShortcuts.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ZenKeyboardShortcuts.mjs b/src/ZenKeyboardShortcuts.mjs index bbb7a48..f5c8f95 100644 --- a/src/ZenKeyboardShortcuts.mjs +++ b/src/ZenKeyboardShortcuts.mjs @@ -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) {