forked from jnoleau/cocoweet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (37 loc) · 1.04 KB
/
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
44
45
46
47
import {app, BrowserWindow} from 'electron';
let mainWindow = null;
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
async function installExtensions(extensions) {
if (process.env.NODE_ENV === 'development') {
const installer = require('electron-devtools-installer'); // eslint-disable-line global-require
const forceDownload = true;
for (const name of extensions) {
try {
await installer.default(installer[name], forceDownload);
} catch (e) {}
}
}
}
app.on('ready', async () => {
await installExtensions([
'REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'
]);
mainWindow = new BrowserWindow({
show: false,
width: 1024,
height: 728
});
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.show();
mainWindow.focus();
});
mainWindow.on('closed', () => {
mainWindow = null;
});
if (process.env.NODE_ENV === 'development') {
mainWindow.openDevTools();
}
});