@yantrix/automata v0.6.0 • Docs
Yantrix API / @yantrix/automata / ModelStore
Class: ModelStore<ModelType> ​
In-memory store for the application-global Data Model.
The store deliberately remains anemic: it owns a snapshot and subscriptions, while all business changes are calculated by pure Effects. A commit is based on reference identity, matching Yantrix's immutable data flow.
Type Parameters ​
• ModelType extends object
Implements ​
IDataModelStore<ModelType>
Methods ​
commit() ​
ts
commit(model): voidAtomically replaces the snapshot and notifies subscribers once. Re-committing the same reference is a no-op.
Parameters ​
• model: ModelType
Returns ​
void
Implementation of ​
IDataModelStore.commit
get() ​
ts
get(): ModelTypeReturns the current Data Model snapshot.
Returns ​
ModelType
Implementation of ​
IDataModelStore.get
subscribe() ​
ts
subscribe(listener): TSubscriptionCancelFunctionSubscribes to committed Data Model changes.
Parameters ​
• listener: TModelListener<ModelType>
Returns ​
TSubscriptionCancelFunction
Implementation of ​
IDataModelStore.subscribe