TinyBase logoTinyBase β

WillSetContentCallback

The WillSetContentCallback type describes a function that is called before Content is set in the Store.

(content: Content): Content | undefined
TypeDescription
contentContent

The Content about to be set.

returnsContent | undefined

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

The callback receives the Content (a [Tables, Values] tuple) that is about to be set. It can return the Content (possibly transformed) to allow the write, or undefined to prevent the Content from being set.

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

Since

v8.0.0