Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • StateManager

Index

Constructors

constructor

Properties

Protected activeStates

activeStates: ActiveState[]

app

Protected commandTokens

commandTokens: CommandOrEventToken[]

Protected eventTokens

eventTokens: CommandOrEventToken[]

libraryId

libraryId: string

Protected modalState

modalState: StateDefinition

Protected previousModalState

previousModalState: StateDefinition

registeredStates

registeredStates: StateDefinition[]

Methods

Protected _exitChildStates

  • Exits any child states that should be exiting on the same command/event as the parent state.

    Parameters

    • state: StateDefinition

      The state to deactivate.

    • commandOrEvent: CommandOrEventInstance

      The command/event instance that is associated with this state.

    • commandOrEventParameter: string

      The command/event's arguments (if any). Only strings are supported.

    Returns void

Protected _exitState

  • Deactivates the current state. Needs to exist outside of _stateExited() as it is also called on state activation in case there is a modal state active.

    Parameters

    • state: StateDefinition

      The state to deactivate.

    • commandOrEvent: CommandOrEventInstance

      The command/event instance that is associated with this state.

    • commandOrEventParameter: string

      The command/event's arguments (if any). Only strings are supported.

    Returns void

Protected _stateEntered

  • Run whenever a state is entered.

    Parameters

    • state: StateDefinition

      The state this is being entered.

    • commandOrEvent: CommandOrEventInstance

      The command/event instance that is associated with this state.

    • commandOrEventArgs: any

      The command/event's arguments (if any). Only strings are supported.

    Returns void

Protected _stateExited

  • Run whenever a state is exited.

    Parameters

    • state: StateDefinition

      The state to exit.

    • commandOrEvent: CommandOrEventInstance

      The command/event instance that is associated with this state.

    • commandOrEventArgs: any

      The command/event's arguments (if any). Only strings are supported.

    Returns void

getActiveStates

  • Returns an array of the currently active states. Does not return children that currently lack an active parent.

    Returns ActiveState[]

getAllStateNames

  • getAllStateNames(): string[]
  • Returns an array with the names of all states in the registry.

    Returns string[]

getModalState

  • Returns the currently active modal state, if any. Returns null if there is no state.

    Returns StateDefinition

getStateByName

  • Returns a state from the manager's registry.

    Parameters

    • stateName: string

      The name of the state to retrieve from the registry.

    Returns StateDefinition

isCurrentlyActive

  • isCurrentlyActive(stateName: string): boolean
  • Returns whether a state is currently active or not.

    Parameters

    • stateName: string

      The name of the state that is being checked.

    Returns boolean

isModalStateActive

  • isModalStateActive(): boolean
  • Returns whether a modal state is currently active or not.

    Returns boolean

onDestroy

  • onDestroy(): void
  • Run when the State Manager is destroyed.

    Returns void

registerState

  • Used to load the states into the registry. Does not allow for duplicate states.

    Parameters

    Returns void