Properties
Read-only snapshot of runtime metadata shared by client handles and active handlers.
Exposed on State (inside handlers as this.hsm properties and forwarded
getters on TopState) and on Hsm (external client code). Values
reflect the current dispatch when read from within an event handler; outside
handlers, eventName and eventPayload are empty.
Extended by
Type Parameters
Context
Context
Protocol
Protocol extends { } | undefined
Properties
currentState
readonlycurrentState:StateClass<Context,Protocol>
Constructor (Function) of the leaf state class currently executing.
Compare with topState, which is always the root composite passed to makeHsm. After a transition, this updates to the new leaf's constructor.
currentStateName
readonlycurrentStateName:string
Human-readable name of currentState.
Sourced from defineStateName / registerStateNames when registered;
otherwise Class.name (unreliable under minification — register names in browser builds).
topState
readonlytopState:StateClass<Context,Protocol>
Constructor of the root state class supplied to makeHsm.
Constant for the lifetime of the instance unless you replace the entire machine.
topStateName
readonlytopStateName:string
Display name of topState (same naming rules as currentStateName).
ctxTypeName
readonlyctxTypeName:string
Runtime label derived from ctx constructor name, used as the first segment of
traceHeader in verbose traces.
traceHeader
readonlytraceHeader:string
Prefix for nested trace domains, built from internal dispatch stack frames.
Empty at the top level; grows like domain|subdomain| during nested operations.
Handlers rarely need to read this directly — it is prepended automatically by
the default TraceWriter.
eventName
readonlyeventName:string
Name of the event or service currently being dispatched.
Matches the string passed to Base.post, Hsm.call, or State.postNow. Empty string when no handler is running.
eventPayload
readonlyeventPayload:any[]
Arguments passed with the current dispatch, excluding injected resolve / reject
for Hsm.call services.
Empty array when idle. Typed as any[] at runtime; correlate with
EventPayload / ServiceRequest at compile time on the client.
traceLevel
traceLevel:
TraceLevel
Active trace verbosity; changing this swaps dispatch tracing behavior immediately.
See
TraceLevel
traceWriter
traceWriter:
TraceWriter
Destination for runtime and handler-initiated trace lines.
Replaceable at any time (e.g. swap in a test double before post/call).
dispatchErrorCallback
dispatchErrorCallback:
DispatchErrorCallback<Context,Protocol>
Last-resort error hook when StateEvents.onError / StateEvents.onUnhandled do not recover.
See
DispatchErrorCallback