Type Alias: ConfirmHandler
API / @xmachines/play-dom / ConfirmHandler
type ConfirmHandler = (confirm, action) => boolean | Promise<boolean>;Defined in: @xmachines/json-render-dom
Hook consulted before executing an action binding that declares confirm.
The DOM renderer is headless, so instead of the framework adapters’
pendingConfirmation state (which a dialog component resolves via
confirmAction() / cancelAction()), @xmachines/json-render-dom exposes a single async
callback: return (or resolve) true to execute the action, false to
skip it. The confirmation flow — window.confirm, a custom dialog, or a
test stub — is entirely the host’s responsibility.
If no ConfirmHandler is configured, confirm-gated actions do NOT execute;
a console.warn is emitted instead. This matches the framework adapters,
where a pending confirmation that is never resolved never runs the handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
confirm | ActionConfirm | The confirm config from the spec, with title and message already ${path}-interpolated against the store. |
action | ResolvedAction | The fully resolved action (name, params, chain handlers). |
Returns
boolean | Promise<boolean>
true (or a promise of true) to execute the action; anything
falsy to skip it silently.
Example
renderSpec(spec, store, registry, { onConfirm: (confirm) => window.confirm(`${confirm.title}\n${confirm.message}`),});