storeApi
storeApi<
T
,TR
>(machine
:StoreMachine
<T
,TR
>):StoreMachineApi
<T
,TR
>
Defined in: store-machine-api.ts:40
Creates an API object for a StoreMachine instance, providing event sender functions for each transition.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type | Description |
---|---|---|
T | - | Type of store state |
TR extends StoreTransitionRecord <T > | StoreTransitionRecord <T > | Type of store transitions |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
machine | StoreMachine <T , TR > | The store machine instance to generate the API for |
Returns
Section titled “Returns”StoreMachineApi
<T
, TR
>
An object mapping transition keys to sender functions
Example
Section titled “Example”const todoApi = eventApi(todoStore);todoApi.addTodo("New task");todoApi.toggleTodo("123");