This repository was archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
69 lines (60 loc) · 1.35 KB
/
index.js
File metadata and controls
69 lines (60 loc) · 1.35 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const electron = require('electron');
const {app, BrowserWindow, Menu} = electron;
//var path = require('path');
app.on('ready',()=>{
const mainWindow = new BrowserWindow({
//width:900,
//height:800,
//frame:false //to hide the top bar of a window which has the close, minimize buttons
webPreferences: {backgroundThrottling:false},
icon: __dirname + '/img/logo.png'
});
mainWindow.loadURL(`file://${__dirname}/index.html`);
const menu = Menu.buildFromTemplate(menuTemplate)
Menu.setApplicationMenu(menu)
});
const menuTemplate = [
{
label: 'File',
submenu:[
{
label:'Quit',
accelerator: (()=>{
if(process.platform==='darwin'){
return 'Command+Q';
}
else{
return 'Ctrl+Q';
}
})(),
click(){
app.quit();
}
},
{
label:'Reset (New)',
accelerator: process.platform === 'darwin' ? 'Command+R':'Ctrl+R',
click(item, focusedWindow){
focusedWindow.reload();
}
}
]
}
];
if(process.platform==='darwin'){
menuTemplate.unshift({});
}
if(process.env.NODE_ENV !== 'production'){
menuTemplate.push({
label:'View',
submenu:[
{
label:'Developer Tools',
accelerator: process.platform === 'darwin' ? 'Command+Alt+I':'Ctrl+Shift+I',
click(item, focusedWindow){
focusedWindow.toggleDevTools();
}
}
]
});
}