Function: bindStoreHandlers()
API / @xmachines/play-view / index / bindStoreHandlers
function bindStoreHandlers<THandlers>(registryResult, getStore): THandlers;Defined in: packages/play-view/src/provider-guards.ts:218
Builds the action handlers of a registry against a state store.
A handler reads the state and writes it through two getters, and each getter reads the store at the moment of the call. A provider whose store changes identity therefore passes a getter that returns the current store, and the handlers stay valid.
Type Parameters
| Type Parameter |
|---|
THandlers |
Parameters
| Parameter | Type | Description |
|---|---|---|
registryResult | HandlerFactory<THandlers> | The result of defineRegistry of the framework. |
getStore | () => Pick<StateStore, "getSnapshot" | "update"> | Returns the store that the handlers read and write: a StateStore, or the value of a useStateStore() of the framework. |
Returns
THandlers
The handlers of the registry.