forked from CIRDLES/MARSdeprecated
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (40 loc) · 1.22 KB
/
index.js
File metadata and controls
48 lines (40 loc) · 1.22 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
'use strict';
const electron = require('electron');
const installExtension = require('electron-devtools-installer').default
const REACT_DEVELOPER_TOOLS = require('electron-devtools-installer').REACT_DEVELOPER_TOOLS
const REDUX_DEVTOOLS = require('electron-devtools-installer').REDUX_DEVTOOLS
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
var mainWindow = null;
app.on('window-all-closed', function() {
if(process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
title: 'MARS',
width: 1366,
height: 768
});
if(process.env.WATCH) {
mainWindow.loadURL('http://localhost:8080/index.html');
} else {
mainWindow.loadURL('file://' + __dirname + '/dist/index.html');
}
if(process.env.DEV) {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => {
console.log(`\nAdded Extension: ${name}`)
return installExtension(REDUX_DEVTOOLS)
})
.then((name) => {
console.log(`Added Extension: ${name}`)
mainWindow.webContents.openDevTools()
})
.catch((err) => console.log('An error occurred: ', err))
}
mainWindow.on('closed', function() {
mainWindow = null;
});
});