EnvironmentContext

Everything an environment knows about itself while mounted: its node, its place in the document, its state and the services the host provides.

@internote/canvas-sdkInterface
On this page
import { EnvironmentContext } from '@internote/canvas-sdk';

The surface receives it as ctx, and the toolbar, footer, animation and freeParameters functions of the definition receive the same object. The host keeps step, isFocused and isPresenting current on it.

Reading the node's attributes goes through animation, which resolves a keyframed attribute to its value at this moment; the node itself carries the raw values as the document does.

#Fields

animationRequired
This environment's animation engine: attribute values at this moment, which elements are present, and anchor windows.
EnvironmentAnimationRuntime<EnvironmentContext>
assetsRequired
The internote's uploaded image assets, file name to public URL, which an environment drawing an uploaded picture resolves its name against. A binary file never arrives as content; a URL is all a surface needs.
Record<string, string> | null

null means the manifest has not arrived yet, as with files.

datasetsRequired
The document's @data datasets by id, which an attribute binding a column (values: #gdp.gdppc) resolves against. Attached CSV files are already folded in, so an attached dataset reads like an inline one.
Record<string, ChalkDataset>
environmentNameRequired
The environment name, such as graph: also its node's identifier.
string
filesRequired
The internote's uploaded text files by name, for attachments whose shape is not a table, such as a boundary .geojson. The environment that understands such a file parses it itself; attached CSVs are already in datasets and are not read from here.
Record<string, string> | null

null means the file manifest has not arrived yet, which is a wait rather than an absence. An empty object means there are no files.

footerRequired
The scene's one footer: whether its panel is open, and the ability to ask for it.
FooterAccess
identityRequired
Which internote, scene and environment this is, and the key its session state is stored under.
EnvironmentIdentity
isFocusedRequired
Whether this environment owns the keyboard. The host focuses one environment at a time.
boolean
isPresentingRequired
Whether the scene is being presented full screen, with the keyboard driving the steps.
boolean
nodeRequired
The compiled environment node, with its attributes and body as the document carries them.
CompiledNode
parametersRequired
The scene's parameters: what its controls declare, where each stands, and how to move one. Shared by every environment in the scene, because a parameter is the scene's: a slider:a written inside one graph is the same a a second graph beside it reads.
SceneParameterAccess
runner
The host's code execution service, for environments that run programs. Absent when the host runs nothing.
CodeRunner
stepRequired
The current step on the scene's timeline, which every environment in the scene shares.
number
stepAnimationRemainingMsRequired
Returns how long the current step's choreography has left to run, in milliseconds, or 0 once it has finished or when the step animates nothing.
number

The same reckoning the playback control uses to offer a replay: the step's span measured from its entry, frozen while paused, and restarted by a replay.

stepCountRequired
How many steps the scene has.
number
still
Whether the host draws a still picture — an exported figure — rather than something read: nothing should play on its own. Read it through isStill, which also honours a reader who asked for reduced motion.
boolean
storageRequired
The storage tiers the definition declared, assembled by the host.
CanvasStorage
tasksRequired
What the environment reports its task parts through — the parts its definition's tasks declared, by the same keys. A report for a part it did not declare is ignored.
TaskReporter

Declared in packages/canvas-sdk/src/environment/types.ts:53.

Last updated