addStoreApi
addStoreApi<
T
,TR
>(machine
:StoreMachine
<T
,TR
>):addEventApi
<StoreMachine
<T
,TR
>>
Defined in: store-machine-api.ts:70
Enhances a StoreMachine instance with an API property containing event sender functions.
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 enhance |
Returns
Section titled “Returns”addEventApi
<StoreMachine
<T
, TR
>>
The enhanced machine with an api property
Example
Section titled “Example”const enhancedTodoStore = addEventApi(todoStore);enhancedTodoStore.api.addTodo("New task");