add show() to show the context menu without re-defining it

This commit is contained in:
buzz-lightsnack-2007 2024-04-23 22:47:00 +08:00
parent db72c0fa36
commit 9b801f33f0

View file

@ -29,7 +29,7 @@ export default class Menu {
};
(this.icon) ? this.#options.icon = this.icon : null;
chrome.contextMenus.create(this.#options);
if (!this.#options.hidden) {this.show(); delete this.#options.hidden;};
delete this.#options.id;
};
@ -37,6 +37,10 @@ export default class Menu {
chrome.contextMenus.remove(this.ID);
};
show() {
chrome.contextMenus.create(this.#options);
}
/* Update the context menu.
@param {Object} options The new options for the context menu.