-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (49 loc) · 1.11 KB
/
Copy pathindex.js
File metadata and controls
54 lines (49 loc) · 1.11 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
const electron = require('electron');
const path = require('path');
require('electron-reload')(__dirname, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
});
const { app, BrowserWindow, Menu } = electron;
let mainWindow;
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
app.on('ready', () => {
const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize;
mainWindow = new BrowserWindow({
width,
height,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.loadURL(`file://${__dirname}/index.html`);
mainWindow.maximize();
mainWindow.setFullScreen(true);
mainWindow.on('resize', () => {
mainWindow.reload();
});
const menu = Menu.buildFromTemplate(mainMenuTemplate);
Menu.setApplicationMenu(menu);
});
const mainMenuTemplate = [
{
label: 'Devtool',
accelerator: 'D',
click() {
mainWindow.webContents.openDevTools();
}
},
{
label: 'Reload',
accelerator: 'R',
click() {
mainWindow.reload();
}
},
{
label: 'Exit',
accelerator: 'X',
click() {
app.exit();
}
}
];