executeMenuAction method added. see #130
This commit is contained in:
parent
4c9db4ab5c
commit
d6a832153a
1 changed files with 19 additions and 0 deletions
|
|
@ -237,4 +237,23 @@ export class mzta_Menus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async executeMenuAction(id) {
|
||||||
|
// Retrieve the action callback from the menu listeners using the provided ID
|
||||||
|
const action = this.menu_listeners[id];
|
||||||
|
|
||||||
|
if (action) {
|
||||||
|
try {
|
||||||
|
// Execute the action callback
|
||||||
|
await action();
|
||||||
|
} catch (error) {
|
||||||
|
// Log any errors that occur during execution
|
||||||
|
console.error(`Error executing action for menu item ${id}:`, error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Warn if no action is found for the provided ID
|
||||||
|
console.warn(`No action found for menu item ID: ${id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue