Package com.episode6.redux

Types

Link copied to clipboard
interface Action

Identifies a redux action that can be dispatched/interpreted by a StoreFlow

Link copied to clipboard
typealias Dispatch = (Action) -> Unit

Function that handles an incoming Action

Link copied to clipboard
fun interface Middleware<State>

Gets the chance to interfere with a StoreFlow's dispatch/processing of actions

Link copied to clipboard
typealias Reducer<State> = State.(Action) -> State

Reduces a state + action to a new state

Link copied to clipboard
interface StoreFlow<State> : Flow<State>

Represents a redux store backed by a kotlinx.coroutines.flow.StateFlow

Functions

Link copied to clipboard
fun <T, R> StoreFlow<T>.mapStore(mapper: (T) -> R): StoreFlow<R>

Maps a StoreFlow that emits a state of type T to one that emits a state of type R, by applying the given mapper to its emissions.

Link copied to clipboard
fun <State> StoreFlow(    scope: CoroutineScope,     initialValue: State,     reducer: Reducer<State>,     middlewares: List<Middleware<State>> = emptyList()): StoreFlow<State>

Creates a new StoreFlow, a redux store backed by a kotlinx.coroutines.flow.StateFlow