From 3d1b0570209073779fdceed15a0e2153f7c5e31b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Thu, 28 Apr 2022 13:43:55 +0200
Subject: [PATCH] [dome] update addMenu and addMenuItem doc

---
 ivette/src/dome/main/dome.ts      |  2 +-
 ivette/src/dome/renderer/dome.tsx | 33 ++++++++++++++-----------------
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts
index c44f5539786..9ab3ca18f76 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 51eb64b19f4..7fb76ae8e9d 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;
 }
 
-- 
GitLab