ChangeRecorder
Index
Constructors
Methods
Constructors
constructor
Returns ChangeRecorder
Methods
publiconRestore
Register callback, for
o
, which will be invoked when restoreAll is called. Useful when a more complex state needs to be restored when restoreAll is called. The callback is then responsible for modifyingo
when restoreAll is called.Type parameters
- O: unknown
Parameters
o: O
Object to register callback for.
onRestore: (obj: O) => void
callback.
Returns void
publicrestoreAll
Reverts all changes made to the objects.
Returns void
publicsave
Save a property
prop
onobj
. This value will be restored when restoreAll is called later.Type parameters
- O: unknown
- P: string | number | symbol
Parameters
obj: O
prop: P
Returns void
publicset
Set a property
prop
onobj
tonewValue
. This can later be reversed by calling restoreAll.Type parameters
- O: unknown
- P: string | number | symbol
- V
Parameters
obj: O
Object to set property on.
prop: P
Property to set
newValue: V
New value which
obj[prop]
will get.
Returns void
Records changes to a object which can later be reversed.