Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Transition<TTrigger>

A transition changes the active state configuration of a state machine by specifying the valid transitions between states and the trigger events that cause them to be traversed.

Type parameters

  • TTrigger = any

    The type of trigger event that this transition will respond to.

Hierarchy

  • Transition

Index

Properties

Methods

Properties

Readonly source

source: Vertex

target

target: Vertex

The target vertex of the transition.

Methods

effect

  • effect(...actions: Behaviour<TTrigger>[]): Transition<TTrigger>
  • Adds user-defined behaviour to the transition that will be called after the source vertex has been exited and before the target vertex is entered.

    Parameters

    • Rest ...actions: Behaviour<TTrigger>[]

      The action, or actions to call with the trigger event as a parameter.

    Returns Transition<TTrigger>

    Returns the transitions thereby allowing a fluent style transition construction.

on

  • on(eventType: Constructor<TTrigger>): Transition<TTrigger>
  • Adds an event type constraint to the transition; it will only be traversed if a trigger event of this type is evaluated.

    Parameters

    • eventType: Constructor<TTrigger>

      The type of trigger event that will cause this transition to be traversed.

    Returns Transition<TTrigger>

    Returns the transitions thereby allowing a fluent style transition construction.

to

  • Specifies a target vertex of the transition and the semantics of the transition.

    Parameters

    • target: Vertex

      The target vertex of the transition.

    • kind: TransitionKind = ...

      The kind of transition, defining the precise semantics of how the transition will impact the active state configuration.

    Returns Transition<TTrigger>

    Returns the transitions thereby allowing a fluent style transition construction.

when

  • when(guard: Function<TTrigger, boolean>): Transition<TTrigger>
  • Adds an guard condition to the transition; it will only be traversed if the guard condition evaluates true for a given trigger event.

    remarks

    It is recommended that this is used in conjunction with the on method, which will first test the type of the trigger event.

    Parameters

    • guard: Function<TTrigger, boolean>

      A boolean predicate callback that takes the trigger event as a parameter.

    Returns Transition<TTrigger>

    Returns the transitions thereby allowing a fluent style transition construction.

Generated using TypeDoc