ElectronMenuItem
Unofficial
Electron MenuItem for adding items to native application menus.
Import:
import type { ElectronMenuItem } from '@obsidian-typings/obsidian-public-latest';Signature:
export class ElectronMenuItemProperties
| Property | Type | Description | |
|---|---|---|---|
| accelerator? | ElectronAccelerator | The item's accelerator, if set. | |
| checked | boolean | Whether the item is checked. This property can be dynamically changed. | |
| commandId | number | An item's sequential unique id. | |
| enabled | boolean | Whether the item is enabled. This property can be dynamically changed. | |
| icon? | ElectronNativeImage | string | The item's icon, if set. | |
| id | string | The item's unique id. This property can be dynamically changed. | |
| label | string | The item's visible label. | |
| menu | ElectronMenu | The menu that the item is a part of. | |
| registerAccelerator | boolean | Whether the accelerator should be registered with the system or just displayed. This property can be dynamically changed. | |
| role? | 'about' | 'appMenu' | 'clearRecentDocuments' | 'close' | 'copy' | 'cut' | 'delete' | 'editMenu' | 'fileMenu' | 'forceReload' | 'front' | 'help' | 'hide' | 'hideOthers' | 'mergeAllWindows' | 'minimize' | 'moveTabToNewWindow' | 'paste' | 'pasteAndMatchStyle' | 'quit' | 'recentDocuments' | 'redo' | 'reload' | 'resetZoom' | 'selectAll' | 'selectNextTab' | 'selectPreviousTab' | 'services' | 'shareMenu' | 'startSpeaking' | 'stopSpeaking' | 'toggleDevTools' | 'togglefullscreen' | 'toggleSpellChecker' | 'toggleTabBar' | 'undo' | 'unhide' | 'viewMenu' | 'window' | 'windowMenu' | 'zoom' | 'zoomIn' | 'zoomOut' | The item's role, if set. | |
| sharingItem | ElectronSharingItem | The item to share when the role is shareMenu. This property can be dynamically changed. darwin only. | |
| sublabel | string | The item's sublabel. | |
| submenu? | ElectronMenu | The menu item's submenu, if present. | |
| toolTip | string | The item's hover text. darwin only. | |
| type | 'checkbox' | 'normal' | 'radio' | 'separator' | 'submenu' | The type of the item. | |
| userAccelerator | ElectronAccelerator | null | The item's user-assigned accelerator for the menu item. Only initialized after the item has been added to a menu; accessing before initialization returns null. darwin only. | |
| visible | boolean | Whether the item is visible. This property can be dynamically changed. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| click(menuItem, browserWindow, event) | void | The click handler that is fired when the menu item receives a click event. |
Links to this page: