Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Transition<TTrigger>

A transition between vertices that defines a valid change in state in response to an event.

Type parameters

  • TTrigger

    The type of triggering event that causes this transition to be traversed.

Hierarchy

  • Transition

Index

Constructors

constructor

  • Creates an instance of the Transition class.

    Parameters

    • source: Vertex

      The source vertex of the transition.

    • Default value target: Vertex | undefined = undefined

      The optional target vertex of the transition; leave undefined for internal transitions.

    • Default value kind: TransitionKind = (target ? TransitionKind.external : TransitionKind.internal)

      The optional kind of the transition: external, internal or local. If left blank, this will be external if a targed vertex is specified otherwise internal.

    • Default value type: Constructor<TTrigger> | undefined = undefined

      The optional type of the trigger event that will cause this transition to be traversed. If left undefined any object or primative type will be considered.

    • Default value guard: Predicate<TTrigger> = () => true

    Returns Transition

Properties

activation

activation: TransitionActivation

The semantics for transition traversal.

internal

source

source: Vertex

The source vertex of the transition.

target

target: Vertex

The target vertex of the transition.

Methods

do

  • Adds behaviour to the transition to be called every time the transition is traversed.

    remarks

    You may make multiple calls to this method to add more behaviour.

    Parameters

    • action: Consumer<TTrigger>

      The behaviour to call on transition traversal.

    Returns this

    Returns the transition.

doActions

  • doActions(trigger: TTrigger): void
  • Execute the user defined transition behaviour.

    Parameters

    • trigger: TTrigger

      The trigger event that caused the transition.

    Returns void

effect

  • effect(action: Consumer<TTrigger>): this
  • A pseudonym of do.

    deprecated

    Use Transition.do instead. This method will be removed in the v8.0 release.

    Parameters

    • action: Consumer<TTrigger>

      The behaviour to call on transition traversal.

    Returns this

    Returns the transition.

evaluate

  • evaluate(trigger: TTrigger): boolean
  • Tests an event against the type test and guard condition to see if the event might cause this transition to be traversed.

    internal

    Parameters

    • trigger: TTrigger

      The triggering event.

    Returns boolean

    Returns true if the trigger passes the type test and guard condition.

if

  • A pseudonym of Transition.when.

    deprecated

    Use Transition.when in its place. This method will be removed in the v8.0 release.

    Parameters

    Returns this

    Returns the transition.

local

  • local(target?: Vertex | undefined): this
  • Specifies the target vertex which is a child of the source and specify it as a local transition.

    deprecated

    Use the to method with the transition type of local

    Parameters

    • Default value target: Vertex | undefined = undefined

      The target vertex of the transition

    Returns this

    Returns the transition.

on

  • Adds a predicate to the transition to ensure events must be of a certain event type for the transition to be traversed.

    Parameters

    • type: Constructor<TTrigger>

      The type of event to test for.

    Returns this

    Returns the transition.

to

  • Specifies the target vertex, thereby making the transition an external transition.

    Parameters

    • target: Vertex

      The target vertex of the transition

    • Default value kind: TransitionKind = TransitionKind.external

    Returns this

    Returns the transition.

toString

  • toString(): string

when

  • Adds a guard condition to the transition enabling event details to determine if the transition should be traversed.

    Parameters

    Returns this

    Returns the transition.

Generated using TypeDoc