API reference › @evolu/common › Store › Store
Defined in: packages/common/src/Store.ts:20
A store for managing state with change notifications. Like a Ref with subscriptions.
Store is a valid dependency in Evolu's Dependency Injection pattern—use it when functions need shared mutable state with subscriptions.
Extends
ReadonlyStore<T>.Ref<T>
Methods
[dispose]()
dispose: void;
Defined in: node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34
Inherited from
Properties
get
readonly get: () => T;
Defined in: packages/common/src/Store.ts:31
Returns the current state of the store.
Inherited from
getAndSet
readonly getAndSet: (value: T) => T;
Defined in: packages/common/src/Ref.ts:54
Sets the current value and returns the previous value.
Inherited from
getAndUpdate
readonly getAndUpdate: (updater: (current: T) => T) => T;
Defined in: packages/common/src/Ref.ts:63
Updates the current value and returns the previous value.
Inherited from
modify
readonly modify: <R>(modifier: (current: T) => readonly [R, T]) => R;
Defined in: packages/common/src/Ref.ts:69
Modifies the current value and returns a computed result.
Inherited from
set
readonly set: (value: T) => void;
Defined in: packages/common/src/Ref.ts:51
Sets the current value.
Inherited from
setAndGet
readonly setAndGet: (value: T) => T;
Defined in: packages/common/src/Ref.ts:57
Sets the current value and returns it.
Inherited from
subscribe
readonly subscribe: (listener: Listener) => Unsubscribe;
Defined in: packages/common/src/Store.ts:37
Registers a listener to be called on state changes and returns a function to unsubscribe.
Inherited from
update
readonly update: (updater: (current: T) => T) => void;
Defined in: packages/common/src/Ref.ts:60
Updates the current value.
Inherited from
updateAndGet
readonly updateAndGet: (updater: (current: T) => T) => T;
Defined in: packages/common/src/Ref.ts:66
Updates the current value and returns it.