1 | /** |
||
2 | * @file Utils |
||
3 | */ |
||
4 | /** |
||
5 | * @module Utils |
||
6 | */ |
||
7 | |||
8 | import {menu} from '../main/index'; |
||
9 | |||
10 | /** |
||
11 | * Get menu item by label. |
||
12 | * @param label {string} The label of the menu item to search for. |
||
13 | * @returns {Electron.MenuItem} - The full menu item. Can change things like checked etc. |
||
14 | */ |
||
15 | export function getMenuItem (label) { |
||
16 | for (let i = 0; i < menu.items.length; i++) { |
||
17 | const menuItem = menu.items[i].submenu.items.find(item => item.label === label); |
||
18 | if (menuItem) return menuItem |
||
19 | } |
||
0 ignored issues
–
show
Best Practice
introduced
by
Loading history...
|
|||
20 | } |
||
21 |