-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·58 lines (47 loc) · 1.33 KB
/
Copy pathindex.js
File metadata and controls
executable file
·58 lines (47 loc) · 1.33 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
57
58
const { app, BrowserWindow, globalShortcut } = require('electron');
const devMode = process.argv.includes('--dev');
function createWindow() {
require('./remote/main').initialize();
const mainWindow = new BrowserWindow({
title: 'Flex 2',
backgroundColor: '#282C34',
width: 1200,
height: 800,
center: true,
resizable: true,
darkTheme: true,
show: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
},
});
require('./remote/main').enable(mainWindow.webContents);
mainWindow.setMenu(null);
globalShortcut.register('CommandOrControl+Shift+I', () => {
mainWindow.webContents.toggleDevTools();
});
mainWindow.loadFile('./index.html');
mainWindow.on('ready-to-show', () => {
mainWindow.show();
if (!devMode) {
mainWindow.focus();
}
});
if (devMode) {
require('./../development/build')({ mainWindow });
}
}
app.allowRendererProcessReuse = true;
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});