API Documentation for: 0.1.0
Show:

FSM Class

Defined in: FSM:35
Module: StateJS

A Finite State Machine implementation.

The FSM does not use the potential method in the state, and it only call the tick method of the current state.

Item Index

Properties

Methods

add

(
  • name
  • state
)

Defined in add:66

Adds a new state to the FSM. The state is identified by a name, which must be unique.

Parameters:

  • name String

    The unique name that identifies the state.

  • state State

    The state object.

get

(
  • name
)
State

Defined in get:85

Returns a registered state instance by name.

Parameters:

Returns:

State:

The state.

initialize

()

Defined in initialize:55

Initialization method.

list

() Array

Defined in list:96

Returns a list of all state names registered in this machine.

Returns:

Array:

An array of state names.

name

(
  • memory
)
String

Defined in name:111

Return the name of the current state. Requires a blackboard instance.

Parameters:

  • memory statejs.Blackboard

    A Blackboard instance.

Returns:

String:

the name of the current state or null if none.

tick

(
  • target
  • memory
)

Defined in tick:150

Propagates the update to current state.

Parameters:

  • target Object

    A target object.

  • memory statejs.Blackboard

    A Blackboard instance.

to

(
  • name
  • target
  • memory
)

Defined in to:122

Change the machine to the new state.

Parameters:

  • name String

    The state name.

  • target Object

    A target object.

  • memory statejs.Blackboard

    A Blackboard instance.

Properties

id

String

Defined in id:46

Machine unique ID.