Fork me on GitHub

Index


  • AsyncUsed as a convenient way to define a state which simply launches an asynchronous function call and waits for the reply.
    • prop asyncDefines either an object or a string controlling how the state should use the plug-in
    • prop async.fnSets the asynchronous function used by the plug-in (the plug-in function).
    • prop async.fnArgsUsed to defined the arguments that are passed to the asynchronous function.
    • event 'async.done'The name of the event injected into the current state when the plug-in function completes without an error.
    • event 'async.err'The name of the event injected into the current state when the plug-in function completes with an error.
    • example
    • source async.js

  • DetectFinds the first element in a specified array that returns true given an asynchronous binary function test.
    • prop detectDefines an object with properties that control how the state should use the plug-in
    • prop detect.fnSets the asynchronous test function.
    • prop detect.fnAgsDefines a synchronous function used to produce the arguments that are passed to the asynchronous test function.
    • prop detect.overSets the array which will be iterated over.
    • prop detect.parSets the maximum number of array elements tested in parallel.
    • event 'detect.done'The name of the event injected into the current state when an element of the array is found that passes the asynchronous function test or when the entire array has been tested.
    • example
    • source detect.js

  • EachUsed as a convenient way to apply an asynchronous function to each element in a specified array.
    • prop eachDefines an object with properties that control how the state should use the plug-in
    • prop each.fnSets the asynchronous function.
    • prop each.fnArgsDefines a synchronous function used to produce the arguments that are passed to the asynchronous function.
    • prop each.iteratorA synchronous function that is called each time the asynchronous functions callback is called (indicating its completion).
    • prop each.overSets the array which will be iterated over.
    • prop each.parSets the maximum number of array elements used in parallel.
    • event 'each.done'The name of the event injected into the current state when when all the array elements have been used and all the respective asnychronous functions calls have returned.
    • example
    • source each.js

  • FilterFilter the elements of a specified array into a new array using an asynchronous filter function.
    • prop filterDefines an object with properties that control how the state should use the plug-in
    • prop filter.fnSets the asynchronous filter function.
    • prop filter.fnArgsDefines a synchronous function used to produce the arguments that are passed to the asynchronous filter function.
    • prop filter.overSets the array which will be iterated over.
    • prop filter.parSets the maximum number of array elements filtered in parallel.
    • event 'filter.done'The name of the event injected into the current state when all the array elements have been filtered and the new array completed.
    • example
    • source filter.js

  • MapUsed to build a new array by calling an asynchronous map function on each element of a specified input array.
    • prop mapDefines an object with properties that control how the state should use the plug-in
    • prop map.fnSets the asynchronous map function.
    • prop map.fnArgsDefines a synchronous function used to produce the arguments that are passed to the asynchronous map function.
    • prop map.iteratorA synchronous function used to produce each new element of the mapped array given the return values of the asynchronous map function.
    • prop map.overSets the array which will be iterated over.
    • prop map.parSets the maximum number of array elements filtered in parallel.
    • event 'map.done'The name of the event injected into the current state when all the array elements have been mapped.
    • example
    • source map.js

  • ReduceUsed to reduce the elements of an array to a single value.
  • SpawnThe spawn plug-in is used as a convenient way to create and start new machines.
  • SubUsed to create a state within a state machine which itself behaves like a complete state machine (the states sub machine).
    • prop subDefines an object with properties that control how the state should use the plug-in
    • prop sub.factoryUsed to set the sub machine definition, either a State Machine Generator Function of a State Machine Factory object.
    • prop sub.smArgsUsed to defined the arguments that are passed to the factory.
    • prop sub.importsUsed to set the imports object passed into the State Machine Factory (if necessary).
    • prop sub.optionsUsed to set the options object passed into the State Machine Factory (if necessary).
    • event 'sub.exit'The name of the event injected into the current state when/if the sub machine reaches the @exit state.
    • event 'sub.error'The name of the event injected into the current state when/if the sub machine reaches the @error state.
    • example
    • source sub.js

  • WorkUsed to allow a state to execute a synchronous function (the work function) asynchronously.
    • prop workDefines an object with properties that control how the state should use the plug-in
    • prop work.fnUsed to set the synchronous function to be executed asynchronously.
    • prop work.fnArgsUsed to defined the arguments that are passed to the work function
    • prop work.ctxUsed to determine the value of `this` inside the function.
    • event 'work.*'The name of the event injected into the current state when the work function returns.
    • example
    • source work.js

  • TickerUsed to generate and inject an event called 'tick' into the curent state of the state machine at regular intervals.
  • TimeoutUsed to inject a single event called 'timeout' into the current state of the state machine after a specified number of milliseconds.