2018-01-05 19:28:01 +00:00
|
|
|
const { app, BrowserWindow } = require('electron');
|
|
|
|
const path = require('path');
|
|
|
|
const url = require('url');
|
|
|
|
|
2018-01-05 20:02:02 +00:00
|
|
|
// init win
|
2018-01-05 19:28:01 +00:00
|
|
|
let win;
|
|
|
|
|
|
|
|
function createWindow() {
|
2018-01-05 20:02:02 +00:00
|
|
|
// Create browser window
|
|
|
|
win = new BrowserWindow({ width: 800, height: 600, icon: });
|
|
|
|
|
|
|
|
// Load index.html
|
|
|
|
win.loadURL(url.format({
|
|
|
|
pathname: path.join(__dirname, 'index.html'),
|
|
|
|
protocol: 'file:',
|
|
|
|
slashes: true
|
|
|
|
}));
|
|
|
|
|
|
|
|
// Open devtools
|
|
|
|
win.webContents().openDevTools();
|
|
|
|
|
|
|
|
win.on('closed', () => {
|
|
|
|
win = null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run create window function
|
|
|
|
app.on('ready', createWindow);
|
|
|
|
|
|
|
|
// Quit when all windows are closed
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
|
|
|
|
// Check if user is on a Mac
|
|
|
|
if (process.platform !== 'darwin') {
|
|
|
|
app.quit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|