From 81c5a3bf1087a23e77bf4ca0a34e747fc8b15f31 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 31 Aug 2022 16:58:36 +0200 Subject: [PATCH 1/3] Mention the trick to disable default menu --- docs/tutorial/performance.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/tutorial/performance.md b/docs/tutorial/performance.md index f1648769ef4f1..1e93a25574ea2 100644 --- a/docs/tutorial/performance.md +++ b/docs/tutorial/performance.md @@ -432,3 +432,16 @@ As of writing this article, the popular choices include [Webpack][webpack], [parcel]: https://parceljs.org/ [rollup]: https://rollupjs.org/ [vscode-first-second]: https://www.youtube.com/watch?v=r0OeHRUCCb4 + + +### 8. Call `Menu.setApplicationMenu(null)` when you do not need a default menu + +A outlined in https://github.com/electron/electron/issues/35512, you can prevent Electron from installing the default menu. + +#### Why? + +If you build your own menu or use a frameless window without menu, this saves some time by preventing Electron from installing a default menu. + +#### How? + +Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. From 355754b1fc7967a2d23fcf49c0abd530e6d50e1f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 31 Aug 2022 21:26:29 -0700 Subject: [PATCH 2/3] fix --- docs/tutorial/performance.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/tutorial/performance.md b/docs/tutorial/performance.md index 1e93a25574ea2..87dcd09c985ab 100644 --- a/docs/tutorial/performance.md +++ b/docs/tutorial/performance.md @@ -419,6 +419,23 @@ environment that needs to handle both Node.js and browser environments. As of writing this article, the popular choices include [Webpack][webpack], [Parcel][parcel], and [rollup.js][rollup]. +### 8. Call `Menu.setApplicationMenu(null)` when you do not need a default menu + +Electron will set a default menu on startup with some standard entries. But +there are reasons your application might want to change that and it will +benefit startup performance. + +#### Why? + +If you build your own menu or use a frameless window without native menu, +you should tell Electron early enough to not setup the default menu. + +#### How? + +Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. This will +prevent Electron from setting a default menu. See also https://github.com/electron/electron/issues/35512 +for a related discussion. + [security]: ./security.md [chrome-devtools-tutorial]: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/ [worker-threads]: https://nodejs.org/api/worker_threads.html @@ -432,16 +449,3 @@ As of writing this article, the popular choices include [Webpack][webpack], [parcel]: https://parceljs.org/ [rollup]: https://rollupjs.org/ [vscode-first-second]: https://www.youtube.com/watch?v=r0OeHRUCCb4 - - -### 8. Call `Menu.setApplicationMenu(null)` when you do not need a default menu - -A outlined in https://github.com/electron/electron/issues/35512, you can prevent Electron from installing the default menu. - -#### Why? - -If you build your own menu or use a frameless window without menu, this saves some time by preventing Electron from installing a default menu. - -#### How? - -Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. From 727ba5efa104e666a6a272738136901be849951f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 5 Sep 2022 01:37:28 -0700 Subject: [PATCH 3/3] lint --- docs/tutorial/performance.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/performance.md b/docs/tutorial/performance.md index 87dcd09c985ab..d06a8220cff02 100644 --- a/docs/tutorial/performance.md +++ b/docs/tutorial/performance.md @@ -421,20 +421,15 @@ As of writing this article, the popular choices include [Webpack][webpack], ### 8. Call `Menu.setApplicationMenu(null)` when you do not need a default menu -Electron will set a default menu on startup with some standard entries. But -there are reasons your application might want to change that and it will -benefit startup performance. +Electron will set a default menu on startup with some standard entries. But there are reasons your application might want to change that and it will benefit startup performance. #### Why? -If you build your own menu or use a frameless window without native menu, -you should tell Electron early enough to not setup the default menu. +If you build your own menu or use a frameless window without native menu, you should tell Electron early enough to not setup the default menu. #### How? -Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. This will -prevent Electron from setting a default menu. See also https://github.com/electron/electron/issues/35512 -for a related discussion. +Call `Menu.setApplicationMenu(null)` before `app.on("ready")`. This will prevent Electron from setting a default menu. See also https://github.com/electron/electron/issues/35512 for a related discussion. [security]: ./security.md [chrome-devtools-tutorial]: https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/