Fix lint warnings
This commit is contained in:
parent
43c44da50b
commit
8f0e594007
2 changed files with 5 additions and 4 deletions
|
@ -82,7 +82,7 @@ BrowserWindow.prototype._init = function () {
|
||||||
let isVisible = this.isVisible() && !this.isMinimized()
|
let isVisible = this.isVisible() && !this.isMinimized()
|
||||||
let visibilityChanged = () => {
|
let visibilityChanged = () => {
|
||||||
let newState = this.isVisible() && !this.isMinimized()
|
let newState = this.isVisible() && !this.isMinimized()
|
||||||
if (isVisible != newState) {
|
if (isVisible !== newState) {
|
||||||
isVisible = newState
|
isVisible = newState
|
||||||
this.webContents.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', isVisible ? 'visible' : 'hidden')
|
this.webContents.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', isVisible ? 'visible' : 'hidden')
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,9 @@ BrowserWindow.prototype._init = function () {
|
||||||
this.on('maximize', visibilityChanged)
|
this.on('maximize', visibilityChanged)
|
||||||
|
|
||||||
// Make renderer process have correct initial state.
|
// Make renderer process have correct initial state.
|
||||||
if (!isVisible)
|
if (!isVisible) {
|
||||||
this.webContents.mergeWebPreferences({visibilityState: 'hidden'})
|
this.webContents.mergeWebPreferences({visibilityState: 'hidden'})
|
||||||
|
}
|
||||||
|
|
||||||
// Notify the creation of the window.
|
// Notify the creation of the window.
|
||||||
app.emit('browser-window-created', {}, this)
|
app.emit('browser-window-created', {}, this)
|
||||||
|
|
|
@ -232,7 +232,7 @@ if (process.visibilityState) {
|
||||||
|
|
||||||
// Subscribe to visibilityState changes.
|
// Subscribe to visibilityState changes.
|
||||||
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, visibilityState) {
|
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, visibilityState) {
|
||||||
if (cachedVisibilityState != visibilityState) {
|
if (cachedVisibilityState !== visibilityState) {
|
||||||
cachedVisibilityState = visibilityState
|
cachedVisibilityState = visibilityState
|
||||||
document.dispatchEvent(new Event('visibilitychange'))
|
document.dispatchEvent(new Event('visibilitychange'))
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, vi
|
||||||
// Make document.hidden and document.visibilityState return the correct value.
|
// Make document.hidden and document.visibilityState return the correct value.
|
||||||
Object.defineProperty(document, 'hidden', {
|
Object.defineProperty(document, 'hidden', {
|
||||||
get: function () {
|
get: function () {
|
||||||
return cachedVisibilityState != 'visible'
|
return cachedVisibilityState !== 'visible'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue