Skip to content
v0.3.3

Browser Lifecycle

@jayoncode/browser-lifecycle

Observe browser state. Derive session intelligence. React with confidence.

One session, one snapshot, one event stream — visibility, focus, connectivity, idle, page lifecycle, and cross-tab, with optional session intelligence and DX.

Pause work when the tab is hidden

import { createBrowserLifecycle } from "@jayoncode/browser-lifecycle";

const lifecycle = createBrowserLifecycle({
  autoStart: true,
  idleTimeout: 60_000,
});

lifecycle.on("page:hidden", () => {
  pausePolling();
  pauseMedia();
});

lifecycle.on("page:visible", () => {
  resumePolling();
});

lifecycle.on("session:idle", () => {
  lockSensitiveScreen();
});

lifecycle.on("connection:reconnect", () => {
  flushOfflineQueue();
});
Read the overview

Why it stands out

Unified Browser Lifecycle

One typed session for visibility, focus, connectivity, idle, page lifecycle, and cross-tab — instead of scattered listeners.

Session Intelligence

Opt-in activity and page-local presence — current derived state for this browser session.

Timeline & Session Insights

Chronological history plus metrics and reports. Nothing allocates until you call the factories.

Developer Experience

Wait, Conditions, Resilience, plugins, and a playground — react with confidence.

An ecosystem of independent, headless TypeScript libraries engineered for modern web development. Every package includes interactive playgrounds and documentation that evolves alongside the code.