createHeadlessCanvasHost
Mounts a compiled document without React or a DOM: step controllers, environment runtimes, session storage and toolbar resolution, exposed for direct use.
@internote/canvas-sdk/hostOn this page
import { createHeadlessCanvasHost } from '@internote/canvas-sdk/host';Registers options.environments, runs the canvas semantic pass, folds attached CSVs into the datasets, then builds a StepController per scene and an EnvironmentAnimationRuntime per environment, applying continue: handoffs before each environment's initial state. The React CanvasDocumentHost renders on top of this same host; a test asserts against it directly, on a clock it controls. The document must already be compiled and refined, as the compile entry's service leaves it.
#Signature
(options: HeadlessHostOptions): HeadlessCanvasHost#Parameters
optionsThe document, the environments to register and the services to hand them.
#Returns
The mounted document. Call dispose() when done with it.
#Example
let now = 0;
const host = createHeadlessCanvasHost({ environments: [greetingEnvironment], document, clock: () => now });
now = 1000;
host.sceneAt(0).steps.goTo(1);
host.sceneAt(0).environments[0].runtime.attrValue('size');Declared in packages/canvas-sdk/src/host/headless.ts:288.