@jayoncode/browser-lifecycle-vue
v0.1.1
Published
Vue adapter for @jayoncode/browser-lifecycle — provide/inject composables and reactive snapshots.
Maintainers
Readme
Browser Lifecycle Vue
Vue adapter for @jayoncode/browser-lifecycle.
Thin wrappers only — no browser observation logic. One session per provide scope; owned sessions dispose on scope teardown, adopted sessions never do. Client-only start() (SSR-safe).
Install
npm install @jayoncode/browser-lifecycle @jayoncode/browser-lifecycle-vueUsage
import { provideBrowserLifecycle, useBrowserLifecycle } from "@jayoncode/browser-lifecycle-vue";
// in setup()
provideBrowserLifecycle();
const { snapshot, lifecycle } = useBrowserLifecycle();Options — { config?, lifecycle? }
provideBrowserLifecycle() and useOwnedBrowserLifecycle() both accept config (forwarded to createBrowserLifecycle()) or lifecycle (an existing session to adopt). Adopt an existing session with { lifecycle: existing } — the adapter will not call start() or dispose() on it.
Owned sessions are always created with autoStart: false internally; the adapter calls start() itself inside onMounted(), so it never runs during server rendering.
See the full adapter guide for the complete API surface, ownership/dispose rules, and more examples.
Docs
Core docs: Browser Lifecycle · Interactive demos: Playground
License
MIT © JayOnCode
