class Action
Wrap a function that will set a new state or event, regarding current state We can target a specific State KClass to ensure we want to execute on it |
|
class ActionDispatcher
Handle dispatch logic to ActionReducer, help wrap Action dispatchAction - Help dispatch given action to ActionReducer, on given coroutineScope context. actionOn - Handle default error behavior by routing back to ::onError function |
|
open class ActionReducer
Action processor component, backed by a coroutine Actor to execute a queue of Actions |
|
interface DataFlow
Unidirectional Data Flow |
|
interface DataPublisher : StatePublisher, EventPublisher
Component that handle State & Event |
|
interface EventPublisher
Component for Event publishing |
|
interface StatePublisher
Component for State publishing |
typealias ActionErrorFunction = suspend (Exception, UIState) -> Unit |
|
typealias ActionErrorFunction_T<T> = suspend (Exception, T) -> Unit |
|
typealias ActionFunction = suspend (UIState) -> Unit |
|
typealias ActionFunction_T<T> = suspend (T) -> Unit |
fun <T : UIState> DataFlow.actionOn(onAction: ActionFunction_T<T>): Unitfun <T : UIState> DataFlow.actionOn(onAction: ActionFunction_T<T>, onError: ActionErrorFunction_T<T>): Unit |
|
fun <T : UIState> StatePublisher.getStateOrNull(): T?
Get state for type T or return null |
|
fun <T : UIState, R : Any> StatePublisher.letOnState(code: (T) -> R): R?
Let execute block on given state T if not null, return a Result R |
|
fun <T : UIState> StatePublisher.onState(code: (T) -> Unit): Unit
Let execute block on given state T if not null |