Differences between revisions 1 and 2
Revision 1 as of 2023-01-08 17:42:47
Size: 630
Comment:
Revision 2 as of 2023-01-08 17:42:54
Size: 636
Comment:
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:


Electron Menu


Usage

const { app, BrowserWindow, menu, shell } = require("electron");

const template = [
  {
    label: 'File',
    submenu: [
      {
        label: 'Exit',
        click() {
          app.quit()
        }
      }
    ]
  },
  {
    label: 'Help',
    submenu: [
      {
        label: 'Learn More',
        click: async () => {
          await shell.openExternal('https://example.org');
        }
      }
    ]
  }
];

const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);


CategoryRicottone

Node/Electron/Menu (last edited 2023-03-02 17:36:05 by DominicRicottone)