Remove locking mechanism from loadMenus method

This commit is contained in:
mic 2025-03-06 21:51:18 +01:00
parent f82b137c10
commit a35fc05e7f

View file

@ -33,7 +33,6 @@ export class mzta_Menus {
menu_context_display = null; menu_context_display = null;
menu_listeners = {}; menu_listeners = {};
logger = null; logger = null;
lock = false;
rootMenu = [ rootMenu = [
//{ id: 'ItemC', act: (info, tab) => { console.log('ItemC', info, tab, info.menuItemId); alert('ItemC') } }, //{ id: 'ItemC', act: (info, tab) => { console.log('ItemC', info, tab, info.menuItemId); alert('ItemC') } },
@ -247,16 +246,10 @@ export class mzta_Menus {
} }
async loadMenus(also_special = []) { async loadMenus(also_special = []) {
while (this.lock) {
this.logger.log("Waiting for the lock to be released...");
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait for the lock to be released
}
this.lock = true;
await this.initialize(also_special); await this.initialize(also_special);
await this.addMenu(this.rootMenu); await this.addMenu(this.rootMenu);
this.addClickListener(); this.addClickListener();
this.loadShortcutMenu(); this.loadShortcutMenu();
this.lock = false;
this.logger.log("Menus loaded"); this.logger.log("Menus loaded");
} }