Skip to content

Defer

The object that a should… hook returns when it cannot answer immediately, for example because it must ask the person a question. The app waits for the promise to settle, and then acts on the decision that the promise produced. While it waits, the screen remains responsive.

If the library changes during the wait, the app checks the change again before applying it. A plugin builds this object with defer(promise, reason), and the documentation of that function contains an example.

Type Parameter Description
P the type of the replacement that an Amend decision carries. For the hooks of ctx.hooks, it is ChangeDraft.
readonly defer: Promise<Decision<P>>;

A promise of the decision to take, which is allow(), veto(…) or amend(…).


readonly reason: string;

A short description of what the app is waiting for.