with Handler
fun <E : StateEvent> withHandler(eventClass: KClass<E>, handler: StateEventHandler<T, E>): EventDrivenStateContainer<T>
Registers an event handler for the specified event type.
This method allows dynamic registration of event handlers after the container has been created. The operation is thread-safe.
Return
A new EventDrivenStateContainer with the added handler
Parameters
event Class
The class of events to handle
handler
The handler for the events