RenderStore

Unpublished development API. This package is under development and is not available as a published release.

A writable state owner, such as createRenderState() from @threadplane/content/render-state. RenderSpec reads its snapshot, re-renders when it changes, and writes view edits through set.

import type { RenderStore } from '@threadplane/react/render';

Declaration

export interface RenderStore  {
  readonly getSnapshot: () => DeepReadonly<Record<string, unknown>>;
  readonly lastChange?: () => {
        readonly path: string;
        readonly value: unknown;
    } | undefined;
  readonly set: (path: string, value: RenderValue) => void;
  readonly subscribe: (notify: () => void) => () => void;
}

Members

getSnapshot

readonly getSnapshot: () => DeepReadonly<Record<string, unknown>>;

lastChange

The last write, so a stateChange event can name its path; the root otherwise.

readonly lastChange?: () => {
        readonly path: string;
        readonly value: unknown;
    } | undefined;

set

readonly set: (path: string, value: RenderValue) => void;

subscribe

readonly subscribe: (notify: () => void) => () => void;