Keep screen on now listens for each lock's release event: when the
browser lets the lock go while the switch is on, the lock is asked for
again at once if the page is visible (or on the next visibilitychange if
hidden), so the switch never claims a lock that is not held. When a
pending request is granted, the hook checks visibility and the lock
again, so a hide-and-show during the request is no longer lost.
Fixes review findings F-01 and F-02 on PR #151.
Maestro task c7da10dc-7f27-4dd0-8548-28d6587bdabf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Keep screen on switch now holds a Screen Wake Lock while on: it asks
navigator.wakeLock.request('screen') when turned on, asks again when the
page is visible again while on, and releases the lock when turned off or
when the screen is left, including a lock granted after the screen was
left. A refused request turns the switch back off and is reported with a
Retry. Without the API the switch is disabled with an explanation.
Maestro task c7da10dc-7f27-4dd0-8548-28d6587bdabf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>