electron/default_app/default_app.js

38 lines
890 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 = {
width: 800,
height: 600,
autoHideMenuBar: true,
2016-04-26 16:25:46 +00:00
backgroundColor: '#FFFFFF',
2016-03-27 17:38:32 +00:00
useContentSize: true
2016-07-06 18:47:21 +00:00
}
if (process.platform === 'linux') {
options.icon = path.join(__dirname, 'icon.png')
}
mainWindow = new BrowserWindow(options)
mainWindow.loadURL(appUrl)
mainWindow.focus()
2016-07-05 19:33:22 +00:00
mainWindow.webContents.on('dom-ready', () => {
mainWindow.webContents.beginFrameSubscription(() => {
console.log("asd")
})
})
2016-07-18 14:16:23 +00:00
mainWindow.webContents.on('paint', (e, rect, w, h, data) => {
console.log('ELECTRON EVENT', rect, w, h, data)
})
})
}