Skip to content

feat: Use cases for Screen Wake Lock API#242

Merged
Artur- merged 2 commits into
mainfrom
wake-lock
May 13, 2026
Merged

feat: Use cases for Screen Wake Lock API#242
Artur- merged 2 commits into
mainfrom
wake-lock

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented May 13, 2026

Adds a wake-lock module mirroring the page-visibility and geolocation modules, with four use cases exercising the new Page#getWakeLock() facade from vaadin/flow#23619:

  • UC1 Manual toggle — minimal API exercise, button + status badge bound to wakeLock.activeSignal().
  • UC2 Recipe — lifetime-of-view pattern; request() on attach and release() on detach.
  • UC3 Slideshow — Signal.effect couples the lock to a presenting signal, so reaching the last slide also releases the lock.
  • UC4 Workout timer — HIIT timer coupling the lock to a running signal; uses TaskScheduler + ui.accessLater for ticks.

Each view has a browserless test; tests reach into the package-private WakeLock#setActive via a reflective WakeLockTestSupport helper, mirroring PageVisibilityTestSupport. wake-lock/API-GAPS.md records six friction points observed while building the views (notably the missing test simulator and missing server-side feature detection).

Pins flow.version to 25.2.wake-lock-SNAPSHOT; revert to a mainline snapshot once the PR is merged.

Artur- added 2 commits May 13, 2026 19:19
Adds a `wake-lock` module mirroring the `page-visibility` and
`geolocation` modules, with four use cases exercising the new
`Page#getWakeLock()` facade from vaadin/flow#23619:

- UC1 Manual toggle — minimal API exercise, button + status badge
  bound to `wakeLock.activeSignal()`.
- UC2 Recipe — lifetime-of-view pattern; `request()` on attach and
  `release()` on detach.
- UC3 Slideshow — `Signal.effect` couples the lock to a `presenting`
  signal, so reaching the last slide also releases the lock.
- UC4 Workout timer — HIIT timer coupling the lock to a `running`
  signal; uses `TaskScheduler` + `ui.accessLater` for ticks.

Each view has a browserless test; tests reach into the package-private
`WakeLock#setActive` via a reflective `WakeLockTestSupport` helper,
mirroring `PageVisibilityTestSupport`. `wake-lock/API-GAPS.md` records
six friction points observed while building the views (notably the
missing test simulator and missing server-side feature detection).

Pins `flow.version` to `25.2.wake-lock-SNAPSHOT`; revert to a mainline
snapshot once the PR is merged.
@Artur- Artur- marked this pull request as ready for review May 13, 2026 16:50
@Artur- Artur- merged commit 984edec into main May 13, 2026
9 checks passed
@Artur- Artur- deleted the wake-lock branch May 13, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant