Start monitors when show page (montage.js)

pull/4054/head
IgorA100 2024-05-29 17:02:34 +03:00 committed by GitHub
parent db45047a3f
commit 3ece22446f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -1103,12 +1103,19 @@ function changeMonitorStatusPositon() {
// Kick everything off
$j(window).on('load', () => initPage());
//Stop monitors when closing page
document.onvisibilitychange = () => {
if (document.visibilityState === "hidden") {
//Stop monitors when closing or hiding page
for (let i = 0, length = monitorData.length; i < length; i++) {
monitors[i].kill();
}
} else {
//Start monitors when show page
for (let i = 0, length = monitorData.length; i < length; i++) {
if (!monitors[i].started) {
monitors[i].start();
}
}
}
};