A hook that is called before a remove()
operation.
The beforeRemove()
hook runs when:
remove()
function is called.The hook also runs when an action is performed on a dataset that removes an item from the collection that the dataset is connected to.
Return a string or a Promise that resolves to a string from the beforeRemove()
function. The returned string will be used as the itemId
parameter for the
remove()
operation. The item with the new itemId
will be removed instead of the item with the original itemId
.
If the returned value is of the wrong type, the value is ignored.
A rejected Promise blocks the call to remove()
and also calls the onFailure()
hook if it has been registered.
Because the beforeRemove()
hook is called before remove()
is executed, it can affect the item that is removed from the collection
or block the remove()
.
The ID of the original item to be removed.
Contextual information about the hook.