TinyBase logoTinyBase β

WillApplyChangesCallback

The WillApplyChangesCallback type describes a function that is called before Changes are applied to the Store.

(changes: Changes): Changes | undefined
TypeDescription
changesChanges

The Changes about to be applied.

returnsChanges | undefined

The Changes to use (possibly transformed), or undefined to prevent the write.

The callback receives the Changes object that is about to be applied. It can return the Changes (possibly transformed) to allow the write, or undefined to prevent the Changes from being applied.

Multiple WillApplyChangesCallback functions can be registered and they will be called sequentially, the Changes being updated successively. If any callback returns undefined, the chain short-circuits and the Changes will not be applied.

Since

v8.0.0