-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
46 lines (40 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const electron = require('electron');
const path = require('path');
const url = require('url');
const {app, BrowserWindow, Menu} = electron;
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
frame: false, //false in production
icon: path.join(__dirname, './assets/img/icon.png'),
});
mainWindow.maximize();
mainWindow.loadFile('./dist/index.html');
mainWindow.on('closed', function(){
app.quit();
});
const mainMenu = Menu.buildFromTemplate(mainMenuTemplate);
Menu.setApplicationMenu(mainMenu); //null in production
});
//create menu
const mainMenuTemplate = [];
//mac thingy
if(process.platform == 'darwin'){
mainMenuTemplate.unshift({});
}
if(process.env.NODE_ENV !== 'production'){
mainMenuTemplate.push({
label: 'DevTools',
submenu:[
{
label: 'Toggle DevTools',
click(item, focusedWindow){
focusedWindow.toggleDevTools();
}
},
{
role: 'reload'
}
]
});
}