SessionStore

The session store one canvas host owns: every environment's and every scene's reading-session state, with per-slot subscribers.

@internote/canvas-sdkClass
On this page
import { SessionStore } from '@internote/canvas-sdk';

A plain map underneath, with no React and no DOM, so the same store backs a React host, an editor preview and a headless test host. Writes notify the slot's subscribers, which is what lets an environment's surface and footer share state without a private channel. Its methods:

  • forEnvironment(identity) returns the scoped view over one environment's slot.
  • forScene(identity) returns the view over a scene's own slot, which holds its parameters and its footer's open state. Not carried by continue:.
  • has(identity) says whether an environment's slot holds anything.
  • continueFrom(from, to, serialize?) seeds one environment's slot from another's, through the definition's serializeForContinue when it has one, and does nothing when the source holds nothing yet.
  • snapshot() and seed(entries) take every slot that is plain data out of one store and put it into another, for a second host that must start exactly where a first one stands — a figure exported from a canvas.
  • clear() drops everything, which a host does on document swap and a test between cases.

#Signature

typeof SessionStore

Declared in packages/canvas-sdk/src/storage/session.ts:124.

Last updated