2016-03-22 18:20:05 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Don't npm install this (it breaks). Rely on the global one.
|
|
|
|
const electron = require('electron');
|
|
|
|
|
|
|
|
const app = electron.app; // Module to control application life.
|
|
|
|
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
|
2016-03-23 05:26:27 +00:00
|
|
|
const IS_DEV = process.env.NODE_ENV === 'development';
|
2016-03-23 18:34:39 +00:00
|
|
|
const IS_MAC = process.platform === 'darwin';
|
2016-03-22 18:20:05 +00:00
|
|
|
var mainWindow = null;
|
|
|
|
|
|
|
|
// Quit when all windows are closed.
|
|
|
|
app.on('window-all-closed', function () {
|
2016-03-23 18:34:39 +00:00
|
|
|
if (!IS_MAC) {
|
2016-03-22 18:20:05 +00:00
|
|
|
app.quit();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
app.on('ready', function () {
|
|
|
|
mainWindow = new BrowserWindow({
|
2016-03-23 05:26:27 +00:00
|
|
|
width: IS_DEV ? 1600 : 1200,
|
|
|
|
height: 800,
|
2016-03-23 05:58:16 +00:00
|
|
|
minHeight: 500,
|
2016-04-09 19:10:34 +00:00
|
|
|
minWidth: 500,
|
2016-04-04 07:15:30 +00:00
|
|
|
acceptFirstMouse: true
|
2016-03-23 18:34:39 +00:00
|
|
|
// titleBarStyle: IS_MAC ? 'hidden-inset' : 'default'
|
2016-03-22 18:20:05 +00:00
|
|
|
});
|
|
|
|
|
2016-03-23 18:34:39 +00:00
|
|
|
// and load the electron.html of the app.
|
2016-03-22 18:20:05 +00:00
|
|
|
mainWindow.loadURL(`file://${__dirname}/app/electron.html`);
|
|
|
|
|
2016-03-23 18:34:39 +00:00
|
|
|
// Open the DevTools.
|
2016-03-23 05:26:27 +00:00
|
|
|
if (IS_DEV) {
|
2016-03-22 18:20:05 +00:00
|
|
|
mainWindow.webContents.openDevTools();
|
|
|
|
}
|
|
|
|
|
2016-03-23 18:34:39 +00:00
|
|
|
// Emitted when the window is closed.
|
2016-03-22 18:20:05 +00:00
|
|
|
mainWindow.on('closed', function () {
|
|
|
|
// Dereference the window object, usually you would store windows
|
|
|
|
// in an array if your app supports multi windows, this is the time
|
|
|
|
// when you should delete the corresponding element.
|
|
|
|
mainWindow = null;
|
|
|
|
});
|
2016-04-09 19:10:34 +00:00
|
|
|
});
|