You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
609 B
37 lines
609 B
"use strict";
|
|
|
|
const {Menu} = require("electron");
|
|
|
|
class MainMenu {
|
|
constructor(app) {
|
|
this.app = app;
|
|
this.menu = null;
|
|
this.buildItems();
|
|
Menu.setApplicationMenu(this.menu);
|
|
}
|
|
|
|
buildItems() {
|
|
const template = [
|
|
...(process.platform === "darwin" ? [{
|
|
role : "appMenu"
|
|
}] : []),
|
|
{
|
|
label : "File",
|
|
submenu : [
|
|
{
|
|
label : "Open",
|
|
accelerator : "CommandOrControl+O",
|
|
click : () => this.app.openFile()
|
|
}
|
|
]
|
|
},
|
|
{
|
|
role : "windowMenu"
|
|
}
|
|
];
|
|
|
|
this.menu = Menu.buildFromTemplate(template);
|
|
}
|
|
}
|
|
|
|
module.exports = MainMenu; |