Implemented Electron packaging support

This commit is contained in:
Marcel
2017-12-16 11:14:20 +01:00
parent d89defae7e
commit 05a4f1abd3
3 changed files with 56 additions and 2 deletions

35
main.js Normal file
View File

@@ -0,0 +1,35 @@
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
let win;
function createWindow () {
win = new BrowserWindow({width: 975, height: 600, minHeight: 300, minWidth: 975});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
win.openDevTools();
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
});
app.on('activate', () => {
if (win === null) {
createWindow()
}
});