yep this seems to work, i'm just an inobservant moron

This commit is contained in:
tim h 2023-01-08 10:11:33 -06:00
parent 1ff5d7b8e4
commit c8cafe36b0

View file

@ -460,24 +460,20 @@ async function testHostConnection() {
// Checks every 5 seconds if offline, 60 seconds if online // Checks every 5 seconds if offline, 60 seconds if online
const checkAgain = () => { const checkAgain = () => {
checkFocus();
if (focused || firstTimeOnline) { if (focused || firstTimeOnline) {
setTimeout( setTimeout(
async () => { async () => {
let simple = !firstTimeOnline; let simple = !firstTimeOnline;
await checkConnection(false, simple); await checkConnection(false, simple);
checkFocus();
checkAgain(); checkAgain();
}, },
connectionStatus ? 60000 : 5000 connectionStatus ? 60000 : 5000
// connectionStatus ? 10000 : 1000 //TODO REMOVE DEBUG REPLACE TO 60000 : 5000
); );
} else { } else {
setTimeout(() => { setTimeout(() => {
console.debug("unfocused, zzz");
checkFocus();
checkAgain(); checkAgain();
}, 60000); }, 60000);
// }, 1000); //TODO REMOVE DEBUG REPLACE TO 60000
} }
}; };
@ -1294,12 +1290,10 @@ document.addEventListener("visibilitychange", () => {
window.addEventListener("blur", () => { window.addEventListener("blur", () => {
checkFocus(); checkFocus();
console.warn("openoutpaint unfocused");
}); });
window.addEventListener("focus", () => { window.addEventListener("focus", () => {
checkFocus(); checkFocus();
console.warn("openoutpaint focused");
}); });
function checkFocus() { function checkFocus() {
@ -1309,5 +1303,4 @@ function checkFocus() {
} else { } else {
focused = true; focused = true;
} }
console.debug("FOCUSED: " + focused); //TODO comment out or something //seriously it stops working without this here wtf
} }