-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
62 lines (54 loc) · 1.43 KB
/
main.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const { app, BrowserWindow, Menu, MenuItem } = require('electron');
const url = require('url');
const path = require('path');
let win;
function createWindow() {
win = new BrowserWindow({
title: "Starting...",
show: false,
width: 650,
height: 375,
backgroundColor: '#272a57',
webPreferences: {
nodeIntegration: true,
backgroundThrottling: false,
enableRemoteModule: true,
resizable: false,
maximizable: false
},
center: true,
frame: false
});
win.loadURL(
url.format({
pathname: path.join(__dirname, '/dist/index.html'),
protocol: "file",
slashes: true
})
);
win.setResizable(false);
win.once('ready-to-show', () => {win.show();});
win.on('closed', () => {win = null;});
}
app.on('ready', function() {
createWindow();
Menu.setApplicationMenu(null);
const ctxMenu = new Menu();
ctxMenu.append(new MenuItem({
label: "Open dev tools",
click: function() {win.webContents.openDevTools();}
}));
win.webContents.on('context-menu', function (event, params) {
ctxMenu.popup(win, params.x, params.y);
});
});
app.on('window-all-closed', function() {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function() {
if (win === null) {
createWindow();
}
});