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

publicstates

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

Accessors

publiccurrentState

  • get currentState(): State
  • set currentState(state: State): 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(elapsedMs: number): void
  • Parameters

    • elapsedMs: number

    Returns void

staticcreate