forked from garrylachman/ElectroCRUD
/
index.js
44 lines (36 loc) · 1021 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
'use strict';
const electron = require('electron');
const path = require('path');
const app = electron.app;
//require('electron-debugger')();
let mainWindow;
function onClosed() {
// dereference the window
// for multiple windows store them in an array
mainWindow = null;
}
function createMainWindow() {
const win = new electron.BrowserWindow({
width: 800,
height: 600,
minWidth: 800,
icon: path.join(__dirname, 'app/images/icons/512.ico')
});
win.loadURL('file://'+__dirname+'/app/index.html');
//win.loadURL('about:blank');
win.on('closed', onClosed);
return win;
}
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow();
}
});
app.on('ready', () => {
mainWindow = createMainWindow();
});