import { app, BrowserWindow } from 'electron' import { enableLiveReload } from 'electron-compile' import path from 'path' import url from 'url' if (process.env.NODE_ENV !== 'production') enableLiveReload() let win = null function createWindow() { win = new BrowserWindow({title: 'Another Neutron app', width: 800, height: 600}) win.loadURL(url.format({ pathname: path.join(__dirname, 'assets/index.html'), protocol: 'file:', slashes: true })) if (process.env.NODE_ENV !== 'production') win.webContents.openDevTools() win.on('close', (event) => { if (app.quitting) win = null else { event.preventDefault() win.hide() } }) } app.on('ready', createWindow) app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { win.show() }) app.on('before-quit', () => app.quitting = true)