diff --git a/docs/api/menu.md b/docs/api/menu.md index ee56fc68adbb..c58a413689e3 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -8,29 +8,26 @@ the `remote` module. Each menu consists of multiple [menu items](menu-item.md) and each menu item can have a submenu. -Below is an example of creating a menu dynamically in a web page -(render process) by using the [remote](remote.md) module, and showing it when -the user right clicks the page: +## Process Difference Notice -```html - - +### Main process +``` +const {Menu, MenuItem} = require('electron'); ``` -An example of creating the application menu in the render process with the +### Render process +``` +const {remote} = require('electron') +const {Menu, MenuItem} = remote; +``` + +## Examples + +### Main process + +An example of creating the application menu in the main process with the simple template API: ```javascript @@ -181,6 +178,31 @@ const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) ``` +### Render process + +Below is an example of creating a menu dynamically in a web page +(render process) by using the [remote](remote.md) module, and showing it when +the user right clicks the page: + +```html + + +``` + + ## Class: Menu ### `new Menu()`