-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (47 loc) · 1.21 KB
/
index.js
File metadata and controls
56 lines (47 loc) · 1.21 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
"use strict";
const {app, BrowserWindow} = require('electron');
const path = require('path');
let winRef;
async function createWindow () {
winRef = new BrowserWindow({
backgroundColor: 'teal',
show: false,
webPreferences: {
devTools: true,
nodeIntegration: true,
contextIsolation: false,
spellcheck: false
},
width: 850,
height: 600,
resizable: true,
titleBarStyle: 'default',
autoHideMenuBar: true,
fullscreen: true,
fullscreenable: true
});
// winRef.setAlwaysOnTop(true);
// winRef.webContents.openDevTools();
// !IMPORTANT: Needs to be defined before loadFile or won't be fired correctly on Windows
// (see https://github.com/electron/electron/issues/25253#issuecomment-1299966191)
winRef.once('ready-to-show', () => {
winRef.show();
});
await winRef.loadFile(path.join(__dirname, 'main.html'), {query: {"app": app.getName(), "ver": app.getVersion()}});
winRef.on('closed', () => {
winRef = null;
})
}
app.on('ready', () => {
createWindow();
});
app.on('window-all-closed', () => {
if (!process.platform.includes('darwin')) {
app.quit();
}
});
app.on('activate', () => {
if (winRef === null) {
createWindow();
}
});