Changes
The Changes
class is responsible for managing changes in a store. It provides methods for changing components, retrieving values, resetting changes, and updating or inserting components.
Example Usage
Methods
changeComponent(id, key, newValue, prevValue, isAsyncStorage)
: Changes a component in the current store. Returns a promise that resolves to the new value.getValue(id, key, storedValue)
: Retrieves the changes of a value. Returns the diffs.reset(changes)
: Resets the changes to a new set of changes or an empty object if no changes are provided. Returns the instance of the Changes class.upsertComponent(id, key, newValue, _prevValue, isAsyncStorage)
: Updates an existing component or inserts a new one if it doesn’t exist in the current store. Returns a promise that resolves to the new value.
Fields
store: StorageInterface
: The store in which changes are to be managed.diffs: Record<string, any>
: The diffs of the changes.