API reference / @evolu/common / Store / Store

Interface: Store<T>

Defined in: packages/common/src/Store.ts:9

A store for managing state with change notifications. Extends Ref with subscriptions. Provides methods to get, set, and modify state, and to notify listeners when the state changes.

Extends

Type Parameters

Type Parameter
T

Properties

PropertyModifierTypeDescriptionOverridesDefined in
getreadonly() => TReturns the current state of the store.Ref.getpackages/common/src/Store.ts:17
modifyreadonly(updater) => voidModifies the store's state by applying a callback function to the current state and notifies listeners if the state changes.Ref.modifypackages/common/src/Store.ts:29
setreadonly(state) => voidUpdates the store's state and notifies all subscribed listeners if the new state differs from the current one.Ref.setpackages/common/src/Store.ts:23
subscribereadonlyStoreSubscribeRegisters a listener to be called on state changes and returns a function to unsubscribe.-packages/common/src/Store.ts:14

Was this page helpful?