Host

For the application embedding a canvas, not for the environments in it: the document and scene hosts, and the adapters they are given for storage, code execution and plugins.

@internote/canvas-sdk@internote/canvas-sdk/host29 exports
On this page

This area is for the application that shows documents, not for the environments in them.

CanvasDocumentHost, from @internote/canvas-sdk/host, draws one scene of a compiled document: its environments and other content in the order the author wrote them, one toolbar and one footer. Import @internote/canvas-sdk/styles once, alongside it.

import { CanvasDocumentHost } from '@internote/canvas-sdk/host';
import '@internote/canvas-sdk/styles';

<CanvasDocumentHost document={compiled} environments={[greetingEnvironment]} />

The host is given the services environments need: db for database-tier storage, and a CodeRunner for environments that run code. Leave one out and the environments that use it do without.

CanvasSceneView draws one scene of a host already mounted. Its footer says what goes under the canvas: scene, the whole footer; key, the scene's key and scales alone with no frame or controls, for a picture of the scene; or none. useSceneHasKey says whether key would draw anything.

createHeadlessCanvasHost takes two options for drawing a picture of a document someone is reading: seed, another host's session.snapshot(), so every environment starts where it stood there; and still, which tells every environment that nothing should play.

createHeadlessCanvasHost mounts a document with no React and no browser. It is what tests use, and what CanvasDocumentHost is built on.

loadEnvironmentFromManifest checks a plugin's manifest, loads its code and registers the environment it defines.

#Components

#Hooks

#Functions

#Interfaces

#Types

Last updated