include ID when recreating context menu

This commit is contained in:
buzz-lightsnack-2007 2024-04-28 16:56:23 +08:00
parent 6171155de4
commit b5a35682fc

View file

@ -69,6 +69,7 @@ export default class Menu {
}
this.#options = {
id: this.ID,
title: this.title,
contexts: this.contexts,
type: this.type
@ -77,7 +78,7 @@ export default class Menu {
(!this.hidden) ? chrome.contextMenus.update(this.ID, this.#options) : false;
(((this.events && (typeof this.events).includes(`obj`) && !Array.isArray(this.events))) ? Object.keys(events) > 0 : false)
(((this.events && (typeof this.events).includes(`obj`) && !Array.isArray(this.events))) ? Object.keys(this.events) > 0 : false)
? (Object.keys(this.events)).forEach((EVENT) => {
chrome.contextMenus[EVENT].addListener((info, tab) => {
((info.menuItemId) ? info.menuItemId == this.ID : false)