Skip to content

@jsvision/ui / confirmBox

Function: confirmBox()

confirmBox(host, message): Promise<"cancel" | "yes" | "no">

Defined in: ui/src/editor/dialogs.ts:146

Show a modal message with Yes / No / Cancel buttons.

Parameters

host

ModalDialogHost

The modal host ({ loop: app.loop, desktop: app.desktop }).

message

string

The message to display; the box sizes itself to fit.

Returns

Promise<"cancel" | "yes" | "no">

The button the user chose ('cancel' also covers closing the box).

Example

ts
const answer = await confirmBox(
  { loop: app.loop, desktop: app.desktop },
  'The file has been modified. Save?',
);
if (answer === 'yes') await save();