WillSetValueCallback
The WillSetValueCallback type describes a function that is called before a Value is set in the Store.
(
valueId: Id,
value: Value,
): ValueOrUndefined| Type | Description | |
|---|---|---|
valueId | Id | |
value | Value | The |
| returns | ValueOrUndefined | The |
The callback receives the value Id and the Value that is about to be set. It can return the Value (possibly transformed) to allow the write, or undefined to prevent the Value from being set.
Multiple WillSetValueCallback functions can be registered and they will be called sequentially, the Value being updated successively. If any callback returns undefined, the chain short-circuits and the Value will not be set.
Since
v8.0.0