electron/default_app/default_app.js

36 lines
760 B
JavaScript
Raw Normal View History

const {app, BrowserWindow} = require('electron')
2016-07-06 18:47:21 +00:00
const path = require('path')
2016-07-06 18:47:21 +00:00
let mainWindow = null
// Quit when all windows are closed.
app.on('window-all-closed', () => {
app.quit()
})
exports.load = (appUrl) => {
app.on('ready', () => {
2016-07-06 18:47:21 +00:00
const options = {
2017-09-29 18:34:48 +00:00
width: 900,
height: 600,
autoHideMenuBar: true,
2016-04-26 16:25:46 +00:00
backgroundColor: '#FFFFFF',
2017-03-15 10:34:21 +00:00
webPreferences: {
nodeIntegrationInWorker: true
},
useContentSize: true,
show: false
2016-07-06 18:47:21 +00:00
}
if (process.platform === 'linux') {
options.icon = path.join(__dirname, 'icon.png')
}
mainWindow = new BrowserWindow(options)
mainWindow.on('ready-to-show', () => mainWindow.show())
mainWindow.loadURL(appUrl)
mainWindow.focus()
})
}