diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts index c44f553978660151a1295defd5da88310dd9e8bf..9ab3ca18f76f7f9c695166ab8ea33a3fe241f931 100644 --- a/ivette/src/dome/main/dome.ts +++ b/ivette/src/dome/main/dome.ts @@ -631,7 +631,7 @@ export function start() { // -------------------------------------------------------------------------- /** - Define a custom main window menu. + Define a custom main window menu. */ export function addMenu(label: string) { Menubar.addMenu(label); diff --git a/ivette/src/dome/renderer/dome.tsx b/ivette/src/dome/renderer/dome.tsx index 51eb64b19f4f5f77a58e6cb45c3ecacd0fcfc471..7fb76ae8e9dd3ad5d000e8eb6012a90cf78c1737 100644 --- a/ivette/src/dome/renderer/dome.tsx +++ b/ivette/src/dome/renderer/dome.tsx @@ -364,13 +364,15 @@ const customItemCallbacks = new Map<string, callback>(); /** Create a new custom menu in the menu bar. - This function can be triggered at any time, and will eventually trigger - an update of the whole application menubar. + + This function shall be called statically, although calls from _secondary_ + windows would be ignored. It is also possible to call this function from the + main process. It is also possible to call this function from the main process. @param label - the menu title (shall be unique) -*/ + */ export function addMenu(label: string) { ipcRenderer.send('dome.ipc.menu.addmenu', label); } @@ -399,8 +401,7 @@ export interface MenuItemProps { onClick?: () => void; } -/** - Inserts a new custom item in a menu. +/** Inserts a new custom item in a menu. The menu can be modified later with [[setMenuItem]]. @@ -408,15 +409,15 @@ export interface MenuItemProps { event on all application windows. The item callback, if any, is invoked only in the process that specify it. - Key short cuts shall be specified with the following codes: - - `"Cmd+<Key>"` for command (MacOS) or control (Linux) key - - `"Alt+<Key>"` for command+option (MacOS) or alt (Linux) key - - `"Meta+<Key>"` for command+shift (MacOS) or control+alt (Linux) key + Key short cuts shall be specified with the following codes: - `"Cmd+<Key>"` + for command (MacOS) or control (Linux) key - `"Alt+<Key>"` for command+option + (MacOS) or alt (Linux) key - `"Meta+<Key>"` for command+shift (MacOS) or + control+alt (Linux) key - This function can be triggered at any time, and will eventually trigger - an update of the complete application menubar. - It is also possible to call this function from the main process. -*/ + This function shall be called statically, although calls from _secondary_ + windows would be ignored. It is also possible to call this function from the + main process. + */ export function addMenuItem(props: MenuItemProps) { if (!props.id && props.type !== 'separator') { // eslint-disable-next-line no-console @@ -444,10 +445,6 @@ export interface MenuItemOptions { You shall specify `null` to remove the previously registered callback (`undefined` callback is ignored). - This function can be triggered at any time, and will possibly trigger - an update of the application menubar if the properties - can not be changed dynamically in Electron. - It is also possible to call this function from the main process. */ export function setMenuItem(options: MenuItemOptions) { @@ -601,7 +598,7 @@ export function useCache<K, V>(r: (k: K) => V, s?: Serialize<K>): (k: K) => V { const v = r(k); cache.set(id, v); return v; - }, [ cache, r, serialize ]); + }, [cache, r, serialize]); return get; }