EffectSender |
Effect sender is an interface that allows you to send effects to be handled outside the handler when you use HandlerWithEffects. interface EffectSender<T> |
Handler |
Handler is a function that receives the current state and an action that just happened and acts on it. typealias Handler<State, Action, Mutation> = (State, Action) -> Flow<Mutation> |
HandlerWithEffects |
A function that on top of what Handler does, it also might emit side effects that are subscribed by an external component. typealias HandlerWithEffects<State, Action, Mutation, Effect> = (State, Action, EffectSender<Effect>) -> Flow<Mutation> |
Logger |
Logger is a lambda you can provide to allow you to do some debugging using your favourite approach for it. typealias Logger = (String) -> Unit |
MVFlow |
Interface that defines all the MVI logic of this library. interface MVFlow<State, Action> |
MVFlowWithEffects |
Extension of MVFlow to be used together with a HandlerWithEffects. interface MVFlowWithEffects<State, Action, Effect> : MVFlow<State, Action> |
Reducer |
Reducer applies a Mutation to a State, returning the resulting State. typealias Reducer<State, Mutation> = (State, Mutation) -> State |
MVFlow |
Constructs a MVFlow object. fun <State, Action, Mutation> MVFlow(initialState: State, handler: Handler<State, Action, Mutation>, reducer: Reducer<State, Mutation>, mvflowCoroutineScope: CoroutineScope, defaultLogger: Logger = {}): MVFlow<State, Action>
Constructs a MVFlow object with side effects. fun <State, Action, Mutation, Effect> MVFlow(initialState: State, handler: HandlerWithEffects<State, Action, Mutation, Effect>, reducer: Reducer<State, Mutation>, mvflowCoroutineScope: CoroutineScope, defaultLogger: Logger = {}): MVFlowWithEffects<State, Action, Effect> |