Skip to content

Session Lifecycle

Create one createBrowserLifecycle() instance per browser tab and drive it through explicit phases:

ts
const lifecycle = createBrowserLifecycle({ autoStart: false });
await lifecycle.start();
// ...
await lifecycle.stop();
await lifecycle.dispose();

Creating a new session on every render or route change without disposing the previous instance.

Trade-offs

autoStart: true is convenient for demos. autoStart: false gives tighter control when registering plugins first.

Playground

Inspect phase transitions in the Lifecycle Playground.

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