on

fun <T : E> on(eventClass: KClass<T>, configuration: EventHandler<S, E>.() -> Unit)

Defines how to handle a specific event in this state. Multiple handlers can be registered for the same event type. When an event is processed, handlers are evaluated in registration order, and the first handler whose guard passes will be executed.

Parameters

eventClass

The class of events to handle

configuration

The configuration block for the event handler


inline fun <T : E> on(noinline configuration: EventHandler<S, E>.() -> Unit)

Defines how to handle a specific event using reified generics. Multiple handlers can be registered for the same event type. When an event is processed, handlers are evaluated in registration order, and the first handler whose guard passes will be executed.

Parameters

configuration

The configuration block for the event handler