mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-04-11 04:58:29 +02:00
Check if window is defined. Not all JS execution environments have it.
This commit is contained in:
parent
e3184622e8
commit
7b2be12587
@ -1081,7 +1081,7 @@
|
|||||||
|
|
||||||
function getServerCapacity() {
|
function getServerCapacity() {
|
||||||
let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length
|
let activeDevicesCount = Object.keys(serverState?.devices?.active || {}).length
|
||||||
if (window.document.visibilityState === 'hidden') {
|
if (typeof window === "object" && window.document.visibilityState === 'hidden') {
|
||||||
activeDevicesCount = 1 + activeDevicesCount
|
activeDevicesCount = 1 + activeDevicesCount
|
||||||
}
|
}
|
||||||
return activeDevicesCount
|
return activeDevicesCount
|
||||||
|
Loading…
Reference in New Issue
Block a user