-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (36 loc) · 994 Bytes
/
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
const CONFIG = require("./config.json");
// Modules to control application life and create native browser window
const {
app,
BrowserWindow
} = require('electron');
let mw = null;
class Window extends BrowserWindow {
constructor() {
super({
width: CONFIG.RESOLUTION.WIDTH,
height: CONFIG.RESOLUTION.HEIGHT
});
this.setMenu(null);
this.loadFile('index.html');
if (CONFIG.DEV === true) {
// Open the DevTools.
this.webContents.openDevTools();
}
// Emitted when the window is closed.
this.on('closed', () => {});
}
static create() {
if (!mw) {
mw = new Window();
}
}
}
app.on('ready', () => Window.create());
app.on('activate', () => Window.create());
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') app.quit();
});