Guides

Events

Engine events for state, limits, errors and imports, and chart view events for user gestures.

Engine events

engine.on(event, listener) returns a function that removes the listener.

EventPayload and moment
changeEngineState. After every effective state change (same moment as subscribe), and once when the license check finishes.
limit{ reason: LimitReason }. An action was refused by a limit; the call also throws limit_reached.
error{ error, context }. Failures that have no caller to reject: a file in an import batch (context: 'import') or a math-channel store call ('mathChannels.create', …).
import{ file, phase, datasetId?, error? }, with phase 'start', 'done' or 'error', per file.
disposeNo payload. engine.dispose() ran (once); from then on every call throws disposed. Stop timers and reads tied to the engine here.
cursorchange{ worksheetId, x }. The shared chart cursor moved (view.setCursorX, or hovering a multiband chart, at most once per frame); x is in X data units, null when it leaves. Ephemeral: never saved or undone.
videochange{ sources }. engine.video.sources() changed: a live camera connected or left, or a recorded source was registered or unregistered.
TypeScript
const offs = [
  engine.on('limit', ({ reason }) => openUpgradeDialog(reason)),
  engine.on('import', ({ file, phase }) => setStatusLine(`${file}: ${phase}`)),
  engine.on('error', ({ error, context }) => report(context, error)),
]
// later: offs.forEach((off) => off())

Chart view events

view.on(event, listener) also returns an unsubscribe function.

EventPayload and moment
status'no-data' | 'empty' | 'missing' | 'ready', when it changes.
contextmenu{ clientX, clientY, zoomXRange? }. The user right-clicked the plot. On a multi-band chart a right-drag selects an X span, passed as zoomXRange. Emitted in every status.
viewchange[x0, x1] | null. The user zoomed or panned a multi-band chart. The worksheet’s linked zoom is already updated.