LiveValueStore
The document's live values, keyed by node id and member: what a derived attribute publishes and a {{#id.member}} reads.
@internote/canvas-sdkimport { LiveValueStore } from '@internote/canvas-sdk';One store serves a whole document, above both the prose and the canvas, so a number in prose follows the environment the reader is manipulating. A surface publishes through usePublishLiveValues and prose reads through ExpressionValue; the store's own methods are for hosts, seeds and tests:
publish(nodeId, member, value)sets a slot, or clears it when the value isundefined, and wakes its subscribers. A value is a number, or the text or truth value a question publishes.publishFree(name, value)supplies a free name, lower-cased.read(nodeId, member)returns a slot's value as a number, a boolean as 1 or 0 and text as absent;readValuereturns it as published;readFree(name)reads a free name.subscribe(nodeId, member, listener)calls the listener after every change to a slot and returns the unsubscribe;slotsFor(nodeId, member)lists every slot a read depends on, which is what a subscriber watches.setCalls(calls)gives the store the document'scallsmap, so an id naming a@defineinvocation resolves through the record on every read.clear()empties every slot.
#Signature
typeof LiveValueStore#Example
const store = new LiveValueStore();
store.publish('fit', 'slope', 2.5);
store.read('fit', 'slope'); // 2.5Declared in packages/canvas-sdk/src/content/live-value-store.ts:116.