TinyBase logoTinyBase β

WillSetCellCallback

The WillSetCellCallback type describes a function that is called before a Cell is set in the Store.

(
  tableId: Id,
  rowId: Id,
  cellId: Id,
  cell: Cell,
): CellOrUndefined
TypeDescription
tableIdId

The Id of the Table being written to.

rowIdId

The Id of the Row being written to.

cellIdId

The Id of the Cell being set.

cellCell

The Cell value about to be set.

returnsCellOrUndefined

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

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

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

Since

v8.0.0