Started working on the app menu
This commit is contained in:
15
src/menu/help.js
Normal file
15
src/menu/help.js
Normal file
@ -0,0 +1,15 @@
|
||||
const { BrowserWindow } = require('electron');
|
||||
|
||||
exports.about = function() {
|
||||
const aboutWindow = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 400,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
});
|
||||
|
||||
// and load the about.html of the app.
|
||||
aboutWindow.loadFile('public/about.html');
|
||||
};
|
30
src/menu/index.js
Normal file
30
src/menu/index.js
Normal file
@ -0,0 +1,30 @@
|
||||
const electron = require('electron');
|
||||
|
||||
// load event handlers
|
||||
const helpHandlers = require('./help');
|
||||
|
||||
exports.createMenu = function(app) {
|
||||
return electron.Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'File',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Close',
|
||||
click: function() {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Help',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About',
|
||||
click: helpHandlers.about
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
};
|
Reference in New Issue
Block a user