TinyBase logoTinyBase β

WillSetTableCallback

The WillSetTableCallback type describes a function that is called before a Table is set in the Store.

(
  tableId: Id,
  table: Table,
): Table | undefined
TypeDescription
tableIdId

The Id of the Table being set.

tableTable

The Table object about to be set.

returnsTable | undefined

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

The callback receives the table Id and the Table object that is about to be set. It can return the Table (possibly transformed) to allow the write, or undefined to prevent the Table from being set.

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

Since

v8.0.0