/
index.js
38 lines (31 loc) · 974 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
'use strict';
const app = require('app');
const BrowserWindow = require('browser-window');
const Menu = require('menu');
// report crashes to the Electron project
require('crash-reporter').start();
// prevent window being GC'd
let mainWindow = null;
app.on('ready', function() {
mainWindow = new BrowserWindow({
// https://github.com/atom/electron/blob/master/docs/api/browser-window.md
'min-width': 1000,
'min-height': 400,
width: 1200,
height: 600,
center: true,
resizable: true
});
mainWindow.loadUrl(`file://${__dirname}/index.html`);
mainWindow.on('closed', function() {
// deref the window
// for multiple windows store them in an array
mainWindow = null;
});
// uncomment the below line to open devetools
//mainWindow.openDevTools();
});
// does not work when placed on top for some reason.
app.on('window-all-closed', function() {
app.quit();
});