Skip to content

Visibility Handling

Pause timers, media, and polling when the page is hidden:

ts
lifecycle.on("page:hidden", () => pauseWork());
lifecycle.on("page:visible", () => resumeWork());

Assuming page:hidden always means the user left the application.

Playground

Visibility Playground

Pattern

Visibility Pause

JOC is a JayOnCode monorepo of @jayoncode/* packages. Docs sync from source via TypeDoc and sync scripts.