Merge pull request #639 from madrang/newEngine

Check if window is defined. Not all JS execution environments have it.
This commit is contained in:
cmdr2 2022-12-11 11:19:11 +05:30 committed by GitHub
commit d3c3496e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1081,7 +1081,7 @@
function getServerCapacity() {
let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length
if (window.document.visibilityState === 'hidden') {
if (typeof window === "object" && window.document.visibilityState === 'hidden') {
activeDevicesCount = 1 + activeDevicesCount
}
return activeDevicesCount