-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
53 lines (43 loc) · 1.3 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
const electron = require('electron');
const { app, BrowserWindow, ipcMain } = electron;
const updater = require('./updater.js');
/////////////////////////////////////////////////////
/// Main Window
/////////////////////////////////////////////////////
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
webPreferences:{
nodeIntegration: true,
enableRemoteModule: true },
width: 1280,
height: 800,
resizable: false,
frame: false
});
mainWindow.setMenuBarVisibility(false);
mainWindow.loadURL(`file://${__dirname}/app/main.html`);
// mainWindow.webContents.openDevTools();
// Check for updates 10 seconds after launch
setTimeout(updater, 10000);
mainWindow.on('closed', () => {
mainWindow = null;
app.quit()
});
});
// Quit when all windows are closed - (Not macOS - Darwin)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
/////////////////////////////////////////////////////
/// IPC handlers
/////////////////////////////////////////////////////
ipcMain.on('ev_app_quit', (event, content) => {
app.quit();
});
ipcMain.on('ev:close', () => {
app.quit();
});
ipcMain.on('ev:minimize', () => {
mainWindow.minimize();
});