Skip to content

@jsvision/ui / confirm

Function: confirm()

confirm(host, text): Promise<boolean>

Defined in: ui/src/dialog/message-box.ts:130

Ask a yes/no question modally.

Parameters

host

ModalDialogHost

The modal host (an Application, or { loop, desktop }).

text

string

The question; the box sizes itself to fit.

Returns

Promise<boolean>

true on Yes; false on No, Esc, or closing the box.

Example

ts
if (await confirm(app, 'Discard unsaved changes?')) discard();