-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
50 lines (42 loc) · 1.02 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
48
49
50
var child_process = require('child_process');
var app = require('app');
var BrowserWindow = require('browser-window');
var dirname = __dirname;
console.log(dirname);
var start = function (callback) {
if (process.env.NODE_ENV === 'development') {
callback(process.env.ROOT_URL);
}
};
mainWindow = null;
app.on('activate-with-no-open-windows', function () {
if (mainWindow) {
mainWindow.show();
}
return false;
});
app.on('ready', function() {
start(function (url) {
var cleanUp = function () {
app.quit();
process.exit();
};
process.on('exit', cleanUp);
process.on('uncaughtException', cleanUp);
process.on('SIGINT', cleanUp);
process.on('SIGTERM', cleanUp);
// Create the browser window.
var windowOptions = {
width: 800,
height: 578,
frame: false,
resizable: true,
'web-preferences': {
'web-security': false
}
};
mainWindow = new BrowserWindow(windowOptions);
mainWindow.focus();
mainWindow.loadUrl(url);
});
});