on Every Transition
fun <S, E : StateEvent> StateMachineBuilder<S, E>.onEveryTransition(effect: (oldState: S, newState: S) -> Unit)
Adds a global side effect that runs on every transition.
Example:
onEveryTransition { old, new -> auditLog.add("$old -> $new") }Content copied to clipboard