Add support for background and overlay pages

This commit is contained in:
Max Goodhart
2020-07-27 11:50:54 -07:00
parent bb4d62050c
commit 38ea3df625
6 changed files with 97 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ export default class StreamWindow extends EventEmitter {
this.win = null
this.offscreenWin = null
this.backgroundView = null
this.overlayView = null
this.views = []
this.viewActions = null
@@ -65,6 +66,21 @@ export default class StreamWindow extends EventEmitter {
})
this.offscreenWin = offscreenWin
const backgroundView = new BrowserView({
webPreferences: {
nodeIntegration: true,
},
})
win.addBrowserView(backgroundView)
backgroundView.setBounds({
x: 0,
y: 0,
width,
height,
})
backgroundView.webContents.loadFile('background.html')
this.backgroundView = backgroundView
const overlayView = new BrowserView({
webPreferences: {
nodeIntegration: true,
@@ -254,5 +270,6 @@ export default class StreamWindow extends EventEmitter {
send(...args) {
this.overlayView.webContents.send(...args)
this.backgroundView.webContents.send(...args)
}
}