Module: core/Menu

Application menu configuration. Custom menu items are added here. The top level object is the menu item name. The second level is the sub-menu name. Add a callback attribute with a function if you want to call a function after a user clicks on the item. Add a 'openWindow' attribute with the name of your window if you want to open a specific window. If both callback and openWindow are provided, the callback will be executed and then the window will be opened. Note: The View and Help menu items are generated in the MenuBuilder

Author:
  • Serge Babayan
Source:

Example

Example of a menu item that calls a function before opening 'project_root/windows/myNewWindow.html'

var Menu = {
 'Windows': { //this is the menu label
   'Open Your New Window': { //this is the submenu label
     callback: function () {
       //optional function to be called before opening window
     },
     openWindow: 'myNewWindow', //name of the window to open (optional)
     height: 800, //height and width of the window. Default is 500 by 500
     width: 600,
     devTools: true, //whether to open chrome devtools with the window (false by default)
     type: 'separator' //whether this sub menu item is a separator
   }
 }
};

Requires

  • module:electron
  • module:util/GainsImporter
  • module:util/PathImporter