Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

BaseStates

BaseStates: "Exception"

TAbortFunction

TAbortFunction: function

Type declaration

    • (): boolean
    • Returns boolean

TAsyncMachine

TAsyncMachine: AsyncMachine<any, IBind, IEmit>

TLogHandler

TLogHandler: function

Type declaration

    • (msg: string, level?: undefined | number): any
    • Parameters

      • msg: string
      • Optional level: undefined | number

      Returns any

TPipeBindings

TStateAction

TStateAction: "add" | "drop" | "set"

TStateMethod

TStateMethod: "enter" | "exit" | "state" | "end"

Functions

machine

  • machine<States, T>(states: string[] | object, constructor?: undefined | object): T
  • machine<States>(states: string[]): AsyncMachine<States, IBind, IEmit>
  • machine<States>(states: object): AsyncMachine<States, IBind, IEmit>
  • Factory function which creates an AsyncMachine instance with specified states.

    States properties are empty, so you'd need to define the relations by yourself.

    Type parameters

    Parameters

    • states: string[] | object

      List of state names to register on the new instance or a map of state names and their attributes.

    • Optional constructor: undefined | object

    Returns T

    The machine instance. You can inherit from it by createChild to make more copies, which are efficient.

    Using a list of names:

    import { machine } from 'asyncmachine'
    
    let states = machine(['A', 'B','C'])
    states.A = { add: ['B'] }
    states.add('A')
    states.is() // -> ['A', 'B']
    

    Using a map:

    import { machine } from 'asyncmachine'
    
    let states = machine({
      A: { add: ['B'] },
      B: {},
      C: {}
    })
    states.add('A')
    states.is() // -> ['A', 'B']
    
  • Type parameters

    • States: string

    Parameters

    • states: string[]

    Returns AsyncMachine<States, IBind, IEmit>

  • Type parameters

    • States: string

    Parameters

    • states: object

    Returns AsyncMachine<States, IBind, IEmit>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc