-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
48 lines (41 loc) · 1.05 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
const electron = require('electron');
const { app, BrowserWindow, screen, webPreferences } = require('electron');
const path = require('path');
let mainWindow;
const createWindow = async () => {
const mainScreen = screen.getPrimaryDisplay();
const win = new BrowserWindow({
width: mainScreen.size.width - 550,
height: mainScreen.size.height - 150,
minWidth: 1380,
minHeight: 950,
frame: false,
icon: path.join(__dirname, '/app/assets/chess.png'),
resizable: false,
webPreferences:{
nodeIntegration: true,
webSecurity: true,
allowEval: false,
contextIsolation: false,
enableRemoteModule: true,
//devTools: false
}
});
win.on('closed', () => {
mainWindow = null;
});
await win.loadFile(path.join(__dirname,'app','index.html'));
return win;
};
if (!app.requestSingleInstanceLock()) {
app.quit();
}
app.on('activate', async () => {
if (!mainWindow) {
mainWindow = await createWindow();
}
});
(async () => {
await app.whenReady();
mainWindow = await createWindow();
})();