When somebody thinks for a while, it can happen that screen turns off. It would be nice if screen was still on. There's an api for that: https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API
So something like:
navigator.wakeLock?.request("screen").then(() => {
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible") {
navigator.wakeLock.request("screen");
}
});
})
should do the trick.
When somebody thinks for a while, it can happen that screen turns off. It would be nice if screen was still on. There's an api for that: https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API
So something like:
should do the trick.