For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /examples/session-storage.md.

Session Storage

A counter saved in session storage, which every page your app shows can read and write.

What it shows

  • LynxSessionStorage — a key-value store that lasts while the host app runs and is shared between its pages. See Share state between pages.
  • watch<number>('counter') — returns a signal that updates when the key changes.
  • setItem() — stores a value. Values can be numbers or objects, not only strings.
  • getItem() — a one-time read that returns a promise. The example shows "(not available)" if it fails.