-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelectron.js
47 lines (37 loc) · 1.26 KB
/
electron.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
45
46
47
/* jshint node: true */
'use strict';
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const emberAppLocation = `file://${__dirname}/dist/index.html`;
let mainWindow = null;
electron.crashReporter.start();
app.on('window-all-closed', function onWindowAllClosed() {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('ready', function onReady() {
mainWindow = new BrowserWindow({
width: 800,
height: 600
});
delete mainWindow.module;
// If you want to open up dev tools programmatically, call
// mainWindow.openDevTools();
// By default, we'll open the Ember App by directly going to the
// file system.
//
// Please ensure that you have set the locationType option in the
// config/environment.js file to 'hash'. For more information,
// please consult the ember-electron readme.
mainWindow.loadURL(emberAppLocation);
// If a loading operation goes wrong, we'll send Electron back to
// Ember App entry point
mainWindow.webContents.on('did-fail-load', () => {
mainWindow.loadURL(emberAppLocation);
});
mainWindow.on('closed', () => {
mainWindow = null;
});
});