Skip to content

Auto Save

Save user input when the session becomes idle or the page is hidden.

Architecture

mermaid
flowchart TD
  Input[User Input] --> App[Application State]
  App --> BL[Browser Lifecycle]
  BL -->|page:hidden / session:idle| Save[Persist Draft]

Composition without coupling — use the FI plugin + optional peer:

See Form Intelligence → Draft on tab hide.

ts
createBrowserLifecyclePlugin({
  saveDraftOnHidden: true,
  lifecycle, // optional shared session
});

Manual wiring

ts
lifecycle.on("page:hidden", () => saveDraft());
lifecycle.on("session:idle", () => saveDraft());

Best practices

Debounce saves and avoid writing on every keystroke. Prefer drafts over writing the full document on every page:hidden if the payload is large.

Playground

Idle Playground · Visibility Playground · FI Workflow

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