behave-app / behave

MIT License
0 stars 0 forks source link

Avoid the app to go to sleep when doing important stuff #12

Closed reinhrst closed 7 months ago

reinhrst commented 9 months ago

For instance, inferring or converting work.

So there are two things here. The easier is that one can use the https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API to make sure that the computer does not go to sleep (downside is that the screen stays on as well, and not locked.... Not ideal but we can add a tick-box for the user.

Secondly however Chrome gives tabs less power when it's not visible (see https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API and https://developer.chrome.com/docs/web-platform/page-lifecycle-api#faqs ). Now I'm pretty sure that I read some info a while back that you can request not to be throttled (and I remember this was behind an experimental flag.... but I don't seem to be able to find this anymore....

I guess worst case we can be playing some sound or update the tab, but this sucks...

reinhrst commented 9 months ago

More info: https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/performance_manager/docs/freezing_opt_out_opt_in.md

reinhrst commented 9 months ago

So in https://polypane.app/experimental-web-platform-features/ they talk about a SystemWakeLock that is an experimental feature. The chrome issue here suggests you can also request a "system" lock (in addition to a "screen" lock)

reinhrst commented 7 months ago

Implemented in c5a460c