Event Driven State Container
State container that handles events and transitions states accordingly.
This container combines state management with event handling, allowing for event-driven state transitions while maintaining thread safety and validation guarantees.
Parameters
The type of state being managed
Types
Functions
Returns true if a handler is registered for the given event.
Returns true if a handler is registered for the given event type.
Conditionally updates the state only if the current state matches the expected state.
Updates the state and returns the previous state if successful, or null if failed.
Returns the current state cast to the specified type, or null if not of that type.
Handles an event and potentially transitions the state.
Returns true if the current state is of the specified type.
Updates the state and returns the new state if successful, or null if failed.
Extension function for StateContainer to perform atomic updates.
Updates the state using the provided updater function.
Transforms the state using a suspending function while maintaining thread safety.
Validates the given state using the container's validator.
Registers an event handler for the specified event type.