StateEventHandler

fun interface StateEventHandler<T, E : StateEvent>

Interface for handling state events and producing new states.

Event handlers are responsible for processing events and determining what the new state should be based on the current state and the event.

Parameters

T

The type of state being handled

E

The type of event being handled

Functions

Link copied to clipboard
abstract fun handle(currentState: T, event: E): T

Handles the given event in the context of the current state.

Link copied to clipboard

Creates a StateEventHandler that always returns the same state regardless of the event.