ReadonlyclockThe clock this session schedules on (delayed sends, deferred event processing).
ReadonlydatamodelThe session's data model (advanced: evaluate expressions against the running chart, for example in tools).
ReadonlydoneResolves when the session terminates, with the top-level final state's
<donedata> (or undefined). It never rejects: a session that is
cancelled or disposed first resolves with undefined — check
session.cancelled to tell the two apart.
ReadonlymodelThe compiled chart the session runs.
ReadonlysessionThe session's id: _sessionid, and the address #_scxml_<sessionId>.
True when the session was ended by cancel() / dispose() rather than by reaching a final state.
Active states, document order.
Active invocations: what <invoke> started and is still running, with the child session for SCXML invokes.
The invoking session and invokeid, when this session was started by <invoke>.
Aborts when the session terminates (final state, cancel) or is disposed.
Pass it to addEventListener(…, { signal }) to tie host listeners to the session.
"idle" before start(), "running", or "done" once the session has terminated (see cancelled for how).
The ids of the active states, document order.
Listen to a session event (microstep, macrostep, log, error, send, invoke, child, done),
typed through SessionEventMap. A listener that throws is logged and can't abort a step.
Optionaloptions: boolean | AddEventListenerOptionsAny other event type (untyped).
Optionaloptions: boolean | AddEventListenerOptionsDeclarative sends by event delegation on root: elements with
data-scxml-send (see bind in bridge.ts for the attribute rules).
Returns a disposer; also disconnects on options.signal abort and when
the session terminates.
Optionaloptions: BindOptionsCancel the session from outside (like a parent cancelling an invoke):
it exits all states, running onexit handlers, without a done event.
Send scxmlEvent whenever target fires domType (space-separated types or an array).
scxmlEvent may be a function of the DOM event (null/undefined: don't send);
data computes the event data. Returns a disposer; also disconnects on
options.signal abort and when the session terminates.
Optionaldata: (e: Event) => unknownOptionaloptions: ConnectOptionsThe dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Release everything the session holds: cancels it if it is still running
(running onexit handlers, no done event), stops its timers, removes
listeners installed by connect() / bind() and attributes set by
reflect, frees the data model context and leaves the session registry.
done resolves (with undefined if it hadn't finished). Safe to call
more than once; the session can't be used afterwards.
The handle an I/O processor uses for this session.
Whether the state with this id is active.
Remove a listener added with addEventListener.
Optionaloptions: boolean | EventListenerOptionsAny other event type (untyped).
Optionaloptions: boolean | EventListenerOptionsEnqueue an external event.
Optionaldata: unknownResolves once the session is idle: both queues are empty and no
processing is scheduled (or the session has terminated / not started).
Pending delayed <send>s and replies still owed by I/O processors or
invoked services do not count — the session is idle while it waits for them.
It is driven by the session's own scheduler, never by polling: with a
VirtualClock, nothing happens until the host calls clock.run(), and
the promise resolves during that call.
A plain-data copy of every variable declared with <data>, keyed by id.
Values are copied out of the data model the way JSON would copy them:
objects and arrays are copied, functions are dropped, dates become ISO
strings, and properties whose value is undefined may be omitted. XML
values are serialised strings with the sandboxed data model and DOM nodes
with the trusted one. Variables created by <script> without <data>
are not included. After dispose() it returns {}.
interpret() — spec Appendix D.
An async iterator over macrosteps, ending when the session terminates
(or options.signal aborts). Macrosteps are buffered, so none are lost
while the consumer is busy.
for await (const step of session.steps()) render(step.configuration);
Resolves with the configuration at the first moment what holds:
immediately, after a macrostep, or on entering a top-level final state
(the configuration is cleared right after that, per the spec).
what: a state id (active), several ids (all active) or a predicate.
Rejects with options.signal.reason on abort, a TimeoutError
DOMException after timeoutMs (measured on the session's clock), or an
Error when the session terminates first.
A session with the trusted data model. Construction is synchronous.