SimpleStore
Defined in: store/adapters/SimpleAdapter.ts:12
Simple store implementation using just plain JavaScript objects.
No external dependencies required. Sync action handling delegates to
applyAction — the shared pure reducer.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
TState | any |
Implements
Section titled “Implements”Store<TState>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SimpleStore<
TState>(initialState):SimpleStore<TState>
Defined in: store/adapters/SimpleAdapter.ts:18
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
initialState | TState |
Returns
Section titled “Returns”SimpleStore<TState>
Methods
Section titled “Methods”dispatch()
Section titled “dispatch()”dispatch(
action):void
Defined in: store/adapters/SimpleAdapter.ts:47
Dispatch an action to update state
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
action | Action |
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”getState()
Section titled “getState()”getState():
TState
Defined in: store/adapters/SimpleAdapter.ts:36
Get the current state
Returns
Section titled “Returns”TState
Implementation of
Section titled “Implementation of”subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Defined in: store/adapters/SimpleAdapter.ts:40
Subscribe to state changes Returns an unsubscribe function
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener | (state) => void |
Returns
Section titled “Returns”() => void