Get a truncated history of the recent states and data of the machine.
+ Turned off by default; configure with .from('...', {data: 5}) by length,
+ or set .history_length at runtime.
+
History does not contain the current state. If you want that, call
+ .history_inclusive instead.
+
constfoo = jssm.from( "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", { history:3 } );
Notice that the machine's current state, e, is not in the returned list.
+
Returns [string, mDT][]
history_inclusive
get history_inclusive(): [string, mDT][]
+
Get a truncated history of the recent states and data of the machine,
+ including the current state. Turned off by default; configure with
+ .from('...', {data: 5}) by length, or set .history_length at runtime.
+
History inclusive contains the current state. If you only want past
+ states, call .history instead.
+
The list returned will be one longer than the history buffer kept, as the
+ history buffer kept gets the current state added to it to produce this
+ list.
+
constfoo = jssm.from( "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;", { history:3 } );
List all transitions attached to the current state, sorted by entrance and
exit. The order of each sublist is not defined. A node could appear in
both lists.
@@ -72,23 +103,23 @@
Parameters
whichState: string = ...
The state whose transitions to have listed
-
Returns JssmTransitionList
lookup_transition_for
lookup_transition_for(from: string, to: string): JssmTransition<mDT>
\ No newline at end of file
diff --git a/docs/docs/index.html b/docs/docs/index.html
index eefc30bf..fc8f78ad 100644
--- a/docs/docs/index.html
+++ b/docs/docs/index.html
@@ -115,4 +115,4 @@
- Preparing search index...
- The search index is not available
JSSM, a JavaScript state machine - the FSM for FSLClass Machine<mDT>
Type parameters
mDT
Hierarchy
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Type parameters
mDT
Parameters
__namedParameters: JssmGenericConfig<mDT>
Returns Machine<mDT>
Properties
_actions
_any_ action_ hook
_any_ transition_ hook
_arrange_ declaration
_arrange_ end_ declaration
_arrange_ start_ declaration
Optional _data
_dot_ preamble
_edge_ map
_edges
_entry_ hooks
_exit_ hooks
_flow
_forced_ transition_ hook
Optional _fsl_ version
_global_ action_ hooks
_graph_ layout
_has_ basic_ hooks
_has_ entry_ hooks
_has_ exit_ hooks
_has_ global_ action_ hooks
_has_ hooks
_has_ named_ hooks
_has_ transition_ hooks
_history
_history_ length
_hooks
_instance_ name
Optional _machine_ author
Optional _machine_ comment
Optional _machine_ contributor
Optional _machine_ definition
Optional _machine_ language
Optional _machine_ license
Optional _machine_ name
Optional _machine_ version
_main_ transition_ hook
_named_ hooks
_named_ transitions
Optional _raw_ state_ declaration
_reverse_ action_ targets
_reverse_ actions
_standard_ transition_ hook
_state
_state_ declarations
_states
_theme
Accessors
history
Get a truncated history of the recent states and data of the machine. + Turned off by default; configure with
+.from('...', {data: 5})
by length, + or set.history_length
at runtime.History does not contain the current state. If you want that, call +
+ +.history_inclusive
instead.Notice that the machine's current state,
+e
, is not in the returned list.Returns [string, mDT][]
history_ inclusive
Get a truncated history of the recent states and data of the machine, + including the current state. Turned off by default; configure with +
+.from('...', {data: 5})
by length, or set.history_length
at runtime.History inclusive contains the current state. If you only want past + states, call
+.history
instead.The list returned will be one longer than the history buffer kept, as the + history buffer kept gets the current state added to it to produce this + list.
+ +Notice that the machine's current state,
+e
, is in the returned list.Returns [string, mDT][]
history_ length
Find out how long a history this machine is keeping. Defaults to zero. + Settable directly.
+Returns number
Find out how long a history this machine is keeping. Defaults to zero. + Settable directly.
+Parameters
to: number
Returns void
Methods
_new_ state
Internal method for fabricating states. Not meant for external use.
-Parameters
state_config: JssmGenericState
Returns string
action
Parameters
state_config: JssmGenericState
Returns string
action
Instruct the machine to complete an action.
The action to engage
Optional newData: mDT
The data change to insert during the action
-Returns boolean
actions
Returns boolean
actions
List all actions available from this state. Please note that the order of the actions is not guaranteed.
Parameters
whichState: string = ...
The state whose actions to have listed
-Returns string[]
current_ action_ edge_ for
Parameters
action: string
Returns JssmTransition<mDT>
current_ action_ for
Parameters
action: string
Returns number
data
Returns string[]
current_ action_ edge_ for
Parameters
action: string
Returns JssmTransition<mDT>
current_ action_ for
Parameters
action: string
Returns number
data
Get the current data of a machine.
Returns mDT
dot_ preamble
Returns string
edges_ between
Parameters
from: string
to: string
Returns JssmTransition<mDT>[]
flow
Returns FslDirection
force_ transition
Returns mDT
dot_ preamble
Returns string
edges_ between
Parameters
from: string
to: string
Returns JssmTransition<mDT>[]
flow
Returns FslDirection
force_ transition
Instruct the machine to complete a forced transition (which will reject if called with a normal transition call.)
Optional newData: mDT
The data change to insert during the transition
-Returns boolean
fsl_ version
Returns string
get_ transition_ by_ state_ names
Parameters
from: string
to: string
Returns number
graph_ layout
Returns string
has_ completes
Returns boolean
has_ state
Returns boolean
fsl_ version
Returns string
get_ transition_ by_ state_ names
Parameters
from: string
to: string
Returns number
graph_ layout
Returns string
has_ completes
Returns boolean
has_ state
Check whether the machine knows a given state.
Parameters
whichState: string
The state to be checked for extance
-Returns boolean
has_ terminals
Returns boolean
has_ unenterables
Returns boolean
hook
Parameters
from: string
to: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ action
Parameters
from: string
to: string
action: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ any_ action
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ any_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ entry
Parameters
to: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ exit
Parameters
from: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ forced_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ global_ action
Parameters
action: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ main_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ standard_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
instance_ name
Returns string
is_ complete
Returns boolean
is_ final
Returns boolean
has_ terminals
Returns boolean
has_ unenterables
Returns boolean
hook
Parameters
from: string
to: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ action
Parameters
from: string
to: string
action: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ any_ action
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ any_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ entry
Parameters
to: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ exit
Parameters
from: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ forced_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ global_ action
Parameters
action: string
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ main_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
hook_ standard_ transition
Parameters
handler: HookHandler<mDT>
Returns Machine<mDT>
instance_ name
Returns string
is_ complete
Returns boolean
is_ final
Check whether the current state is final (either has no exits or is marked
complete
.)Returns boolean
is_ terminal
Returns boolean
is_ unenterable
Parameters
whichState: string
Returns boolean
list_ actions
Returns string[]
list_ edges
Returns boolean
is_ terminal
Returns boolean
is_ unenterable
Parameters
whichState: string
Returns boolean
list_ actions
Returns string[]
list_ edges
Lists all edges of a machine.
Returns JssmTransition<mDT>[]
list_ entrances
Returns JssmTransition<mDT>[]
list_ entrances
List all entrances attached to the current state. Please note that the order of the list is not defined.
Parameters
whichState: string = ...
The state whose entrances to have listed
-Returns string[]
list_ exit_ actions
Parameters
whichState: string = ...
Returns string[]
list_ exits
Returns string[]
list_ exit_ actions
Parameters
whichState: string = ...
Returns string[]
list_ exits
List all exits attached to the current state. Please note that the order of the list is not defined.
Parameters
whichState: string = ...
The state whose exits to have listed
-Returns string[]
list_ named_ transitions
Returns Map<string, number>
list_ states_ having_ action
Returns string[]
list_ named_ transitions
Returns Map<string, number>
list_ states_ having_ action
List all states that have a specific action attached. Please note that the order of the states is not guaranteed.
Parameters
whichState: string
The action to be checked for associated states
-Returns string[]
list_ transitions
Returns string[]
list_ transitions
List all transitions attached to the current state, sorted by entrance and exit. The order of each sublist is not defined. A node could appear in both lists.
@@ -72,23 +103,23 @@Parameters
whichState: string = ...
The state whose transitions to have listed
-Returns JssmTransitionList
lookup_ transition_ for
Parameters
from: string
to: string
Returns JssmTransition<mDT>
machine_ author
Returns string[]
machine_ comment
Returns string
machine_ contributor
Returns string[]
machine_ definition
Returns string
machine_ language
Returns string
machine_ license
Returns string
machine_ name
Returns string
machine_ state
Returns JssmMachineInternalState<mDT>
machine_ version
Returns string
probabilistic_ histo_ walk
Parameters
n: number
Returns Map<string, number>
probabilistic_ transition
Returns boolean
probabilistic_ walk
Parameters
n: number
Returns string[]
probable_ action_ exits
Parameters
whichState: string = ...
Returns any[]
probable_ exits_ for
Parameters
whichState: string
Returns JssmTransition<mDT>[]
raw_ state_ declarations
Returns Object[]
set_ hook
Parameters
HookDesc: HookDescription<mDT>
Returns void
sm
Parameters
template_strings: TemplateStringsArray
Rest ...remainder: any[]
Returns Machine<mDT>
state
Returns JssmTransitionList
lookup_ transition_ for
Parameters
from: string
to: string
Returns JssmTransition<mDT>
machine_ author
Returns string[]
machine_ comment
Returns string
machine_ contributor
Returns string[]
machine_ definition
Returns string
machine_ language
Returns string
machine_ license
Returns string
machine_ name
Returns string
machine_ state
Returns JssmMachineInternalState<mDT>
machine_ version
Returns string
probabilistic_ histo_ walk
Parameters
n: number
Returns Map<string, number>
probabilistic_ transition
Returns boolean
probabilistic_ walk
Parameters
n: number
Returns string[]
probable_ action_ exits
Parameters
whichState: string = ...
Returns any[]
probable_ exits_ for
Parameters
whichState: string
Returns JssmTransition<mDT>[]
raw_ state_ declarations
Returns Object[]
set_ hook
Parameters
HookDesc: HookDescription<mDT>
Returns void
sm
Parameters
template_strings: TemplateStringsArray
Rest ...remainder: any[]
Returns Machine<mDT>
state
Get the current state of a machine.
Returns string
state_ declaration
Parameters
which: string
Returns JssmStateDeclaration
state_ declarations
Returns Map<string, JssmStateDeclaration>
state_ for
Parameters
whichState: string
Returns JssmGenericState
state_ is_ complete
Parameters
whichState: string
Returns boolean
state_ is_ final
Returns string
state_ declaration
Parameters
which: string
Returns JssmStateDeclaration
state_ declarations
Returns Map<string, JssmStateDeclaration>
state_ for
Parameters
whichState: string
Returns JssmGenericState
state_ is_ complete
Parameters
whichState: string
Returns boolean
state_ is_ final
Check whether a given state is final (either has no exits or is marked
complete
.)Parameters
whichState: string
The name of the state to check for finality
-Returns boolean
state_ is_ terminal
Parameters
whichState: string
Returns boolean
states
Returns boolean
state_ is_ terminal
Parameters
whichState: string
Returns boolean
states
List all the states known by the machine. Please note that the order of these states is not guaranteed.
Returns string[]
theme
Returns FslTheme
transition
Returns string[]
theme
Returns FslTheme
transition
Instruct the machine to complete a transition.
The state to switch to
Optional newData: mDT
The data change to insert during the transition
-Returns boolean
transition_ impl
Parameters
newStateOrAction: string
newData: mDT
wasForced: boolean
wasAction: boolean
Returns boolean
valid_ action
Parameters
action: string
Optional _newData: mDT
Returns boolean
valid_ force_ transition
Parameters
newState: string
Optional _newData: mDT
Returns boolean
valid_ transition
Parameters
newState: string
Optional _newData: mDT
Returns boolean
Generated using TypeDoc