API Documentation for: 0.1.0
Show:

State Class

Defined in: State:35
Module: StateJS

The State class represents generic states that works for all machines. Some machines require the implementation of specific methods in this class. Please consult the documentation of the machine you want to use and the description of each method here.

To extend the State class you can use the statejs.Class function:

var MyState = statejs.Class(statejs.State);

MyState.prototype.tick = function(target, memory) {
  console.log('My Implementation')
}

Item Index

Properties

Methods

enter

(
  • target
  • memory
)

Defined in enter:83

Enter method, override this to use. It is called when the machine assume this state as the current one

Parameters:

  • target Object

    A target object, commonly an agent.

  • memory Object

    A blackboard object.

exit

(
  • target
  • memory
)

Defined in exit:121

Exit method is called when the state is replaced by another on the machine.

Parameters:

  • target Object

    A target object, commonly an agent.

  • memory Object

    A blackboard object.

initialize

()

Defined in initialize:72

Initialization method.

potential

(
  • target
  • memory
)

Defined in potential:93

The potential method is used to some machines for different things. Consult the machine documentation to know how to implement this.

In general, this method is used by machines to verify if the state is able to execute at a given moment or not.

Parameters:

  • target Object

    A target object, commonly an agent.

  • memory Object

    A blackboard object.

tick

(
  • target
  • memory
)

Defined in tick:110

Tick method is called every time a machine is asked to update. Depending on the machine, the State tick may only be called if it is the current executing state. Consult the machine documentation to known more.

Parameters:

  • target Object

    A target object, commonly an agent.

  • memory Object

    A blackboard object.

Properties

id

String

Defined in id:54

State unique ID.

machine

Object

Defined in machine:63

The reference to the machine in which this state was added.