Register visibility change listener when attached
This commit is contained in:
parent
2f5f7721fc
commit
f4717b34e9
1 changed files with 2 additions and 1 deletions
|
@ -34,10 +34,10 @@ class WebViewImpl {
|
||||||
this.viewInstanceId = getNextId()
|
this.viewInstanceId = getNextId()
|
||||||
shadowRoot.appendChild(this.browserPluginNode)
|
shadowRoot.appendChild(this.browserPluginNode)
|
||||||
|
|
||||||
|
// Forward window visibility changes to guest contents
|
||||||
this.onVisibilityChanged = (event, visibilityState) => {
|
this.onVisibilityChanged = (event, visibilityState) => {
|
||||||
this.webviewNode.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', visibilityState)
|
this.webviewNode.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', visibilityState)
|
||||||
}
|
}
|
||||||
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', this.onVisibilityChanged)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createBrowserPluginNode () {
|
createBrowserPluginNode () {
|
||||||
|
@ -315,6 +315,7 @@ var registerWebViewElement = function () {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!internal.elementAttached) {
|
if (!internal.elementAttached) {
|
||||||
|
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', internal.onVisibilityChanged)
|
||||||
guestViewInternal.registerEvents(internal, internal.viewInstanceId)
|
guestViewInternal.registerEvents(internal, internal.viewInstanceId)
|
||||||
internal.elementAttached = true
|
internal.elementAttached = true
|
||||||
instance = internal.attributes[webViewConstants.ATTRIBUTE_GUESTINSTANCE].getValue()
|
instance = internal.attributes[webViewConstants.ATTRIBUTE_GUESTINSTANCE].getValue()
|
||||||
|
|
Loading…
Reference in a new issue