Skip to content
Snippets Groups Projects
Commit 3d1b0570 authored by Loïc Correnson's avatar Loïc Correnson Committed by David Bühler
Browse files

[dome] update addMenu and addMenuItem doc

parent 28fb400a
No related branches found
No related tags found
No related merge requests found
...@@ -631,7 +631,7 @@ export function start() { ...@@ -631,7 +631,7 @@ export function start() {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
Define a custom main window menu. Define a custom main window menu.
*/ */
export function addMenu(label: string) { export function addMenu(label: string) {
Menubar.addMenu(label); Menubar.addMenu(label);
......
...@@ -364,13 +364,15 @@ const customItemCallbacks = new Map<string, callback>(); ...@@ -364,13 +364,15 @@ const customItemCallbacks = new Map<string, callback>();
/** /**
Create a new custom menu in the menu bar. 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. It is also possible to call this function from the main process.
@param label - the menu title (shall be unique) @param label - the menu title (shall be unique)
*/ */
export function addMenu(label: string) { export function addMenu(label: string) {
ipcRenderer.send('dome.ipc.menu.addmenu', label); ipcRenderer.send('dome.ipc.menu.addmenu', label);
} }
...@@ -399,8 +401,7 @@ export interface MenuItemProps { ...@@ -399,8 +401,7 @@ export interface MenuItemProps {
onClick?: () => void; 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]]. The menu can be modified later with [[setMenuItem]].
...@@ -408,15 +409,15 @@ export interface MenuItemProps { ...@@ -408,15 +409,15 @@ export interface MenuItemProps {
event on all application windows. The item callback, if any, is invoked only event on all application windows. The item callback, if any, is invoked only
in the process that specify it. in the process that specify it.
Key short cuts shall be specified with the following codes: Key short cuts shall be specified with the following codes: - `"Cmd+<Key>"`
- `"Cmd+<Key>"` for command (MacOS) or control (Linux) key for command (MacOS) or control (Linux) key - `"Alt+<Key>"` for command+option
- `"Alt+<Key>"` for command+option (MacOS) or alt (Linux) key (MacOS) or alt (Linux) key - `"Meta+<Key>"` for command+shift (MacOS) or
- `"Meta+<Key>"` for command+shift (MacOS) or control+alt (Linux) key control+alt (Linux) key
This function can be triggered at any time, and will eventually trigger This function shall be called statically, although calls from _secondary_
an update of the complete application menubar. windows would be ignored. It is also possible to call this function from the
It is also possible to call this function from the main process. main process.
*/ */
export function addMenuItem(props: MenuItemProps) { export function addMenuItem(props: MenuItemProps) {
if (!props.id && props.type !== 'separator') { if (!props.id && props.type !== 'separator') {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
...@@ -444,10 +445,6 @@ export interface MenuItemOptions { ...@@ -444,10 +445,6 @@ export interface MenuItemOptions {
You shall specify `null` to remove the previously registered callback You shall specify `null` to remove the previously registered callback
(`undefined` callback is ignored). (`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. It is also possible to call this function from the main process.
*/ */
export function setMenuItem(options: MenuItemOptions) { export function setMenuItem(options: MenuItemOptions) {
...@@ -601,7 +598,7 @@ export function useCache<K, V>(r: (k: K) => V, s?: Serialize<K>): (k: K) => V { ...@@ -601,7 +598,7 @@ export function useCache<K, V>(r: (k: K) => V, s?: Serialize<K>): (k: K) => V {
const v = r(k); const v = r(k);
cache.set(id, v); cache.set(id, v);
return v; return v;
}, [ cache, r, serialize ]); }, [cache, r, serialize]);
return get; return get;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment