-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·63 lines (49 loc) · 1.39 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
// main.js
// Module to control application life.
var app = require('app');
// Module to create native browser window.
var BrowserWindow = require('browser-window');
var mainWindow = null;
// Report crashes to our server.
require('crash-reporter').start();
// Quit when all windows are closed.
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
console.log('Exiting.');
app.quit();
}
});
// Force single instance of application
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window
if (mainWindow) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();
}
return true;
});
if (shouldQuit) {
app.quit();
return;
}
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 1400,
height: 1200
});
mainWindow.loadUrl('file://' + __dirname + '/oahenv/index.html');
mainWindow.setMenuBarVisibility(false);
// Open the DevTools.
mainWindow.webContents.openDevTools({
detach: true
});
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});