37 lines
890 B
JavaScript
37 lines
890 B
JavaScript
const {app, BrowserWindow} = require('electron')
|
|
const path = require('path')
|
|
|
|
let mainWindow = null
|
|
|
|
// Quit when all windows are closed.
|
|
app.on('window-all-closed', () => {
|
|
app.quit()
|
|
})
|
|
|
|
exports.load = (appUrl) => {
|
|
app.on('ready', () => {
|
|
const options = {
|
|
width: 800,
|
|
height: 600,
|
|
autoHideMenuBar: true,
|
|
backgroundColor: '#FFFFFF',
|
|
useContentSize: true
|
|
}
|
|
if (process.platform === 'linux') {
|
|
options.icon = path.join(__dirname, 'icon.png')
|
|
}
|
|
|
|
mainWindow = new BrowserWindow(options)
|
|
mainWindow.loadURL(appUrl)
|
|
mainWindow.focus()
|
|
mainWindow.webContents.on('dom-ready', () => {
|
|
mainWindow.webContents.beginFrameSubscription(() => {
|
|
console.log("asd")
|
|
})
|
|
})
|
|
|
|
mainWindow.webContents.on('paint', (e, rect, w, h, data) => {
|
|
console.log('ELECTRON EVENT', rect, w, h, data)
|
|
})
|
|
})
|
|
}
|