Skip to main content

StateMachine <TPossibleStates, TData>

Index

Constructors

constructor

  • new StateMachine<TPossibleStates, TData>(): StateMachine<TPossibleStates, TData>
  • Type parameters

    • TPossibleStates: string
    • TData

    Returns StateMachine<TPossibleStates, TData>

Properties

publicdata

data: TData

publicstartState

startState: State<TData>

publicstates

states: Map<string, State<TData>> = ...

Accessors

publiccurrentState

  • get currentState(): State<TData>
  • set currentState(state: State<TData>): void
  • Returns State<TData>

  • Parameters

    Returns void

Methods

go

  • go(stateName: TPossibleStates, eventData?: any): boolean
  • Parameters

    • stateName: TPossibleStates
    • optionaleventData: any

    Returns boolean

in

  • in(state: TPossibleStates): boolean
  • Parameters

    • state: TPossibleStates

    Returns boolean

restore

  • restore(saveKey: string): void
  • Parameters

    • saveKey: string

    Returns void

save

  • save(saveKey: string): void
  • Parameters

    • saveKey: string

    Returns void

update

  • update(elapsed: number): void
  • Parameters

    • elapsed: number

    Returns void

staticcreate