-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·47 lines (37 loc) · 928 Bytes
/
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
'use strict';
var app = require('app');
var BrowserWindow = require('browser-window');
// report crashes to the Electron project
require('crash-reporter').start();
// adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();
// prevent window being GC'd
var mainWindow;
function createMainWindow() {
var win = new BrowserWindow({
width: 800,
height: 500,
resizable: true
});
win.loadUrl('file://' + __dirname + '/index.html');
win.on('closed', onClosed);
return win;
}
function onClosed() {
// deref the window
// for multiple windows store them in an array
mainWindow = null;
}
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate-with-no-open-windows', function () {
if (!mainWindow) {
mainWindow = createMainWindow();
}
});
app.on('ready', function () {
mainWindow = createMainWindow();
});