2016-05-06 17:53:50 -06:00
|
|
|
const {app, BrowserWindow} = require('electron')
|
2016-07-06 11:47:21 -07:00
|
|
|
const path = require('path')
|
2013-07-17 16:21:33 +08:00
|
|
|
|
2016-07-06 11:47:21 -07:00
|
|
|
let mainWindow = null
|
2013-07-17 16:21:33 +08:00
|
|
|
|
|
|
|
// Quit when all windows are closed.
|
2016-05-06 17:53:50 -06:00
|
|
|
app.on('window-all-closed', () => {
|
2016-03-24 13:15:04 -07:00
|
|
|
app.quit()
|
|
|
|
})
|
2013-07-17 16:21:33 +08:00
|
|
|
|
2016-05-06 17:53:50 -06:00
|
|
|
exports.load = (appUrl) => {
|
|
|
|
app.on('ready', () => {
|
2016-07-06 11:47:21 -07:00
|
|
|
const options = {
|
2017-09-29 11:34:48 -07:00
|
|
|
width: 900,
|
2016-02-04 10:26:11 -08:00
|
|
|
height: 600,
|
|
|
|
autoHideMenuBar: true,
|
2016-04-26 09:25:46 -07:00
|
|
|
backgroundColor: '#FFFFFF',
|
2017-03-15 19:34:21 +09:00
|
|
|
webPreferences: {
|
|
|
|
nodeIntegrationInWorker: true
|
|
|
|
},
|
2016-03-27 10:38:32 -07:00
|
|
|
useContentSize: true
|
2016-07-06 11:47:21 -07:00
|
|
|
}
|
|
|
|
if (process.platform === 'linux') {
|
|
|
|
options.icon = path.join(__dirname, 'icon.png')
|
|
|
|
}
|
|
|
|
|
|
|
|
mainWindow = new BrowserWindow(options)
|
2016-03-24 13:15:04 -07:00
|
|
|
mainWindow.loadURL(appUrl)
|
|
|
|
mainWindow.focus()
|
|
|
|
})
|
|
|
|
}
|