1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const {app, BrowserWindow} = require('electron');
|
11 | const {join} = require('path');
|
12 |
|
13 | const argv = require('minimist')(process.argv.slice(2));
|
14 | const projectRoots = argv._;
|
15 |
|
16 | let mainWindow = null;
|
17 |
|
18 | app.on('window-all-closed', function() {
|
19 | app.quit();
|
20 | });
|
21 |
|
22 | app.on('ready', function() {
|
23 |
|
24 | mainWindow = new BrowserWindow({
|
25 | width: 800,
|
26 | height: 600,
|
27 | icon: join(__dirname, 'icons/icon128.png'),
|
28 | frame: false,
|
29 |
|
30 | webPreferences: {
|
31 | nodeIntegration: true,
|
32 | },
|
33 | });
|
34 |
|
35 |
|
36 | mainWindow.loadURL('file://' + __dirname + '/app.html');
|
37 | mainWindow.webContents.executeJavaScript(
|
38 |
|
39 |
|
40 |
|
41 | 'window.devtools.setProjectRoots(' + JSON.stringify(projectRoots) + ')',
|
42 | );
|
43 |
|
44 |
|
45 | mainWindow.on('closed', function() {
|
46 | mainWindow = null;
|
47 | });
|
48 | });
|