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.
| Event | Payload and moment |
|---|---|
change | EngineState. 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. |
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.
| Event | Payload and moment |
|---|---|
status | 'no-data' | 'empty' | '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. |