transition

fun transition(startState: S, event: E, targetState: S?, guard: StateGuard<C, A>?, action: AsyncStateAction<C, A, R>?)

This function defines a transition from the currentState equal to startState to the targetState when event is received and the guard expression is met. The action is executed after any exit action and before entry actions.

Parameters

startState

The transition will be considered when currentState matches stateState

event

The event will trigger the consideration of this transition

targetState

The transition will change currentState to targetState after executing the option action

guard

The guard expression will have to be met to consider the transition

action

The optional action will be executed when the transition occurs.