Class: State

HSM. State

new State(theStateID)

Represents a State.
Parameters:
Name Type Description
theStateID String Identifies the state. Must be unique in the containing state machine.
Source:

Members

#handler[event] :HSM.State~Handler|Array.<HSM.State~Handler>

Map of events to handlers. Either a single handler or an array of handlers can be given. The guard of each handler will be called until a guard returns true (or a handler doesn't have a guard). This handler will then be triggered.
Type:
Source:

State#on_entry :HSM.State~EntryFunc

Type:
Source:

State#on_exit :HSM.State~ExitFunc

Type:
Source:

Type Definitions

ActionFunc(source, target, data)

An action function may be attached to any transition. It will be called after all exit handlers and before all entry handlers are called.
Parameters:
Name Type Description
source HSM.State current state
target HSM.State next state
data event parameters
Source:
See:

EntryFunc(source, target, data)

Parameters:
Name Type Description
source HSM.State state
target HSM.State state
data event parameters
Source:

ExitFunc(source, target, data)

Parameters:
Name Type Description
source HSM.State state
target HSM.State state
data event parameters
Source:

GuardFunc(source, target, data)

A guard function may be attached to any transition. It will be called before the transition is fired. If it doesn't return true, the transition will be disabled for the current event.
Parameters:
Name Type Description
source HSM.State current state
target HSM.State potential next state
data event parameters
Source:

Handler

Type:
  • Object
Properties:
Name Type Attributes Description
target HSM.State target state
guard HSM.State~GuardFunc <optional>
disables the transition unless returns true.
action HSM.State~ActionFunc <optional>
called after all state exit handlers and before any state entry handlers are called.
Source: