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
Ref<T>
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Modifier | Type | Description | Overrides | Defined in |
|---|---|---|---|---|---|
get | readonly | () => T | Returns the current state of the store. | Ref.get | packages/common/src/Store.ts:17 |
modify | readonly | (updater) => void | Modifies the store's state by applying a callback function to the current state and notifies listeners if the state changes. | Ref.modify | packages/common/src/Store.ts:29 |
set | readonly | (state) => void | Updates the store's state and notifies all subscribed listeners if the new state differs from the current one. | Ref.set | packages/common/src/Store.ts:23 |
subscribe | readonly | StoreSubscribe | Registers a listener to be called on state changes and returns a function to unsubscribe. | - | packages/common/src/Store.ts:14 |