let isVisible = this.isVisible() && !this.isMinimized()
let visibilityChanged = () => {
let newState = this.isVisible() && !this.isMinimized()
- if (isVisible != newState) {
+ if (isVisible !== newState) {
isVisible = newState
this.webContents.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', isVisible ? 'visible' : 'hidden')
}
this.on('maximize', visibilityChanged)
// Make renderer process have correct initial state.
- if (!isVisible)
+ if (!isVisible) {
this.webContents.mergeWebPreferences({visibilityState: 'hidden'})
+ }
// Notify the creation of the window.
app.emit('browser-window-created', {}, this)
// Subscribe to visibilityState changes.
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, visibilityState) {
- if (cachedVisibilityState != visibilityState) {
+ if (cachedVisibilityState !== visibilityState) {
cachedVisibilityState = visibilityState
document.dispatchEvent(new Event('visibilitychange'))
}
// Make document.hidden and document.visibilityState return the correct value.
Object.defineProperty(document, 'hidden', {
get: function () {
- return cachedVisibilityState != 'visible'
+ return cachedVisibilityState !== 'visible'
}
})