-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (35 loc) · 891 Bytes
/
index.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
const { app, BrowserWindow, ipcMain } = require('electron');
function createWindow() {
let win = new BrowserWindow({
width: 1500, height: 800,
minWidth: 800, minHeight: 600,
webPreferences: {
nodeIntegration: true
},
icon: __dirname + '/www/favicon.ico'
});
win.loadFile('./www/index.html');
win.setAutoHideMenuBar(true);
if (isDevMode) {
win.webContents.openDevTools();
}
}
const isDevMode = process.execPath.match(/[\\/]electron[\\/]/);
if (isDevMode) {
require('electron-reload')(__dirname, {
electron: require(`${ __dirname }/node_modules/electron`)
});
}
app.whenReady().then(createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
// macOS dock icon click
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});