Correctly set initial visibilityState
This commit is contained in:
parent
07a4c52919
commit
43c44da50b
8 changed files with 37 additions and 17 deletions
|
@ -5,7 +5,6 @@ const remote = require('electron').remote
|
|||
|
||||
// Helper function to resolve relative url.
|
||||
var a = window.top.document.createElement('a')
|
||||
|
||||
var resolveURL = function (url) {
|
||||
a.href = url
|
||||
return a.href
|
||||
|
@ -160,8 +159,6 @@ window.alert = function (message, title) {
|
|||
title: title,
|
||||
buttons: buttons
|
||||
})
|
||||
|
||||
// Alert should always return undefined.
|
||||
}
|
||||
|
||||
// And the confirm().
|
||||
|
@ -227,8 +224,13 @@ Object.defineProperty(window.history, 'length', {
|
|||
}
|
||||
})
|
||||
|
||||
// The initial visibilityState.
|
||||
let cachedVisibilityState = 'visible'
|
||||
if (process.visibilityState) {
|
||||
cachedVisibilityState = process.visibilityState
|
||||
}
|
||||
|
||||
// Subscribe to visibilityState changes.
|
||||
let cachedVisibilityState = 'hidden'
|
||||
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, visibilityState) {
|
||||
if (cachedVisibilityState != visibilityState) {
|
||||
cachedVisibilityState = visibilityState
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue