TinyBase logoTinyBase β

WillSetRowCallback

The WillSetRowCallback type describes a function that is called before a Row is set in the Store.

(
  tableId: Id,
  rowId: Id,
  row: Row,
): Row | undefined
TypeDescription
tableIdId

The Id of the Table being written to.

rowIdId

The Id of the Row being set.

rowRow

The Row object about to be set.

returnsRow | undefined

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

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

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

Since

v8.0.0