Changes
The Changes class provides methods for managing changes in a context.
Constructors
new Changes(store, changes)
new Changes(
store
,changes
?):Changes
Creates a new instance of the Changes class.
Parameters
• store: StorageInterface
The store in which changes are to be managed.
• changes?: ChangesInput
An optional initial set of changes.
Returns
Source
Methods
changeComponent()
changeComponent(
id
,key
,newValue
,prevValue
,isAsyncStorage
):Promise
<any
[]>
Changes a component in the current context.
Parameters
• id: string
The ID of the component to be changed.
• key: string
The key of the property to be changed.
• newValue: any
The new value of the property.
• prevValue: any
The previous value of the property.
• isAsyncStorage: boolean
= false
Whether the storage is asynchronous.
Returns
Promise
<any
[]>
The new value.
Source
getValue()
getValue(
id
,key
,storedValue
):Record
<string
,any
>
Retrieves the changes of a value.
Parameters
• id: string
The ID of the component.
• key: string
The key of the property.
• storedValue: any
The stored value.
Returns
Record
<string
, any
>
The diffs.
Source
reset()
reset(
changes
?):Changes
Resets the changes to a new set of changes or an empty object if no changes are provided.
Parameters
• changes?: ChangesInput
The new set of changes.
Returns
The instance of the Changes class.
Source
upsertComponent()
upsertComponent(
id
,key
,newValue
,_prevValue
,isAsyncStorage
):any
Updates an existing component or inserts a new one if it doesn’t exist in the current context.
Parameters
• id: string
The ID of the component to be updated or inserted.
• key: string
The key of the property to be updated or inserted.
• newValue: any
The new value of the property.
• _prevValue: any
The previous value of the property.
• isAsyncStorage: boolean
= false
Whether the storage is asynchronous.
Returns
any
The new value.
Source
Generated using typedoc-plugin-markdown and TypeDoc