electron-window-state
Advanced tools
Comparing version 4.0.2 to 4.1.0
28
index.js
@@ -10,4 +10,4 @@ 'use strict'; | ||
module.exports = function (options) { | ||
var app = electron.app; | ||
var screen = electron.screen; | ||
var app = electron.app || electron.remote.app; | ||
var screen = electron.screen || electron.remote.screen; | ||
var state; | ||
@@ -77,13 +77,15 @@ var winRef; | ||
} | ||
var winBounds = win.getBounds(); | ||
if (isNormal(win)) { | ||
state.x = winBounds.x; | ||
state.y = winBounds.y; | ||
state.width = winBounds.width; | ||
state.height = winBounds.height; | ||
} | ||
state.isMaximized = win.isMaximized(); | ||
state.isFullScreen = win.isFullScreen(); | ||
state.displayBounds = screen.getDisplayMatching(winBounds).bounds; | ||
// don't throw an error when window was closed | ||
try { | ||
var winBounds = win.getBounds(); | ||
if (isNormal(win)) { | ||
state.x = winBounds.x; | ||
state.y = winBounds.y; | ||
state.width = winBounds.width; | ||
state.height = winBounds.height; | ||
} | ||
state.isMaximized = win.isMaximized(); | ||
state.isFullScreen = win.isFullScreen(); | ||
state.displayBounds = screen.getDisplayMatching(winBounds).bounds; | ||
} catch (err) {} | ||
} | ||
@@ -90,0 +92,0 @@ |
{ | ||
"name": "electron-window-state", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "Simple module that helps to save and restore size and position of Electron windows.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10089
153