on

inline fun <SubAction : A> on(executionPolicy: ExecutionPolicy = ExecutionPolicy.CANCEL_PREVIOUS, noinline handler: suspend (action: SubAction, state: State<InputState>) -> ChangedState<S>)

Triggers every time an action of type SubAction is dispatched while the state machine is in this state.

An ongoing handler is cancelled when leaving this state. executionPolicy is used to determine the behavior when a new SubAction is dispatched while the previous handler execution is still ongoing. By default an ongoing handler is cancelled when leaving this state or when a new SubAction is dispatched.