Skip to content

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 ParameterDefault typeDescription
T-Type of store state
TR extends StoreTransitionRecord<T>StoreTransitionRecord<T>Type of store transitions
ParameterTypeDescription
machineStoreMachine<T, TR>The store machine instance to enhance

addEventApi<StoreMachine<T, TR>>

The enhanced machine with an api property

const enhancedTodoStore = addEventApi(todoStore);
enhancedTodoStore.api.addTodo("New task");