Keep the screen on and ask before leaving while a session is busy
While a share waits or a transfer runs, the page holds a Screen Wake Lock, requested again once the page is visible, since the browser releases it whenever it's hidden. A beforeunload handler makes the browser ask before a reload or a closed tab ends the session, only while busy so the page stays eligible for the back/forward cache otherwise. Covered by awake: with a fake wake lock, a headless browser may not grant a real one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
870d55b44f
commit
44a8a72261
3 files changed
+128
-6
No files matched your search
@@ -15,12 +15,10 @@
|
||||
deployments on different versions, the receiver only sees "No sender with this code". Open how a
|
||||
mismatch would be reported, e.g. by trying the previous version's swarm too.
|
||||
|
||||
- Keep a transfer alive on phones: while a share waits or a transfer runs, hold a Screen Wake Lock
|
||||
(`navigator.wakeLock.request('screen')`), else a phone that dims and locks suspends the tab and
|
||||
the connection dies. The browser releases it whenever the page is hidden, so it has to be
|
||||
requested again on `visibilitychange`. In the same phases, a `beforeunload` handler makes the
|
||||
browser ask before a reload or a closed tab ends the share or transfer. Both go once it's done,
|
||||
stopped or failed.
|
||||
- Revisit the screen wake lock: a browser that keeps refusing it (e.g. in a power saving mode) logs
|
||||
"screen may lock" each time the page is visible again, open whether once per session is enough.
|
||||
`awake: …` doesn't cover a session that ends in an error, nor one that ends while a request is
|
||||
still pending, the case the `wakeLock === request` checks in `holdWakeLock` are for.
|
||||
|
||||
## Open observations
|
||||
|
||||
|
||||
Reference in new issue
Block a user