Skip to content

Veto

The object that a should… hook returns to refuse a change. The change is not applied, the person sees the message, and whoever made the change is told which plugin refused it and why.

A plugin builds this object with veto(code, message). The first veto that the app receives ends the processing of the change.

ctx.hooks.shouldDelete({ on: 'row', onTimeout: 'veto' }, delta => {
return isProtected(delta) ? veto('protected', 'This row cannot be deleted') : allow();
});
readonly veto: object;

The reason for the refusal, given as a short code for programs and as a sentence for the person.

readonly code: string;

A short, stable name for the reason, such as protected. Other code can compare with it, for example to find out why a change was refused.

readonly message: string;

The sentence that the person reads.