Fire Object API
method $addToLibrary(name, obj)
Used to import objects into the state machine environment dynamically. This can be useful when wanting to use asynchronous functions within the state machine that can not be declared in the imports object, usually because the functions are returned from constructor functions (or similar) once the machine has started running.
parameters
name- String: The name of the imported object.
obj- Object: The object to import.
method $regEmitter(name, eventEmitter [,persistent [,emitFnName]])
Used to register an event emitter within a state machine. Once registered, any event emitted by the event emitter will be captured and injected back into the current state of the machine.
parameters
name- String: The name of the event emitter to be registered. The name is used to prefix ('.' delimited) the name of any event emitted from the registered event emitter.
eventEmitter- EventEmitter: The event emitter.
persistent- Boolean: Indicating whether the event emitter is persistent. If set to
false(orundefined) then the event emitter is automatically deregistered as soon as the machine leaves the state in which the event emitter was registered. emitFnName- String: Used to override the default name for the
emitfunction on the event emitter (see node.js EventEmitter.emit).
method $deregEmitter(name)
Used to deregister an event emitter from within a state machine.
parameters
name- String: The name of the event emitter to be deregistered.
method $cb(eventName [, arg1 [, arg2 [...]]])
Used to create a callback function which when called simply injects an event back into the state machine.
parameters
eventName- String: The name of the event emitted when the generated callback function is called and returns
[, arg1 [, arg2 [...]]]- varags: The event arguments.
method $event(eventName [, arg1 [, arg2 [...]]])
Used to emit an event from the state machine instance (See State Machine API).
parameters
eventName- String: The name of the event emitted.
[, arg1 [, arg2 [...]]]- varargs: The event arguments.
method $factoryEvent(eventName [, arg1 [, arg2 [...]]])
Used to emit an event from the state machine factory used to create the state machine instance (See Factory API).
parameters
eventName- String: The name of the event emitted.
[, arg1 [, arg2 [...]]]- varargs: The event arguments.
method $lastEvtName()
Returns the name of the last event injected into the state machine.