do not remove what has already been removed
This commit is contained in:
parent
786302927d
commit
5c86f87394
1 changed files with 16 additions and 14 deletions
|
@ -34,11 +34,12 @@ export default class Menu {
|
|||
};
|
||||
|
||||
remove() {
|
||||
(!this.hidden) ? chrome.contextMenus.remove(this.ID) : false;
|
||||
this.hidden = true;
|
||||
chrome.contextMenus.remove(this.ID);
|
||||
};
|
||||
|
||||
show() {
|
||||
if (this.hidden || this.hidden == null) {
|
||||
this.hidden = false;
|
||||
this.ID = chrome.contextMenus.create(this.#options);
|
||||
|
||||
|
@ -52,6 +53,7 @@ export default class Menu {
|
|||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the context menu.
|
||||
|
||||
|
@ -71,7 +73,7 @@ export default class Menu {
|
|||
};
|
||||
(this.icon) ? this.#options.icon = this.icon : null;
|
||||
|
||||
chrome.contextMenus.update(this.ID, this.#options);
|
||||
(!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)
|
||||
? (Object.keys(this.events)).forEach((EVENT) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue