kvision / pl.treksoft.kvision.redux / ReduxStore

ReduxStore

(js) class ReduxStore<S : Any, A : RAction> : ObservableState<S>

A class implementing redux pattern backed by the Redux Kotlin library.

Constructors

(js)

<init>

Creates a Redux store with given reducer function and initial state.

ReduxStore(reducer: ReducerFun<S, A>, initialState: S, vararg middlewares: Middleware<S>)
ReduxStore(reducer: Reducer<S, A>, initialState: S, vararg middlewares: dynamic)

Functions

(js)

dispatch

Dispatches a synchronous action object.

fun dispatch(action: A): Unit

Dispatches an asynchronous action function.

fun dispatch(actionCreator: ActionCreator<A, S>): Unit
fun dispatch(actionCreator: ActionCreator<dynamic, S>): WrapperAction
(js)

getState

Get current state.

fun getState(): S
(js)

subscribe

Subscribe for the state change notifications.

fun subscribe(observer: (S) -> Unit): () -> Unit