Skip to content

@jsvision/ui / confirmBox

Function: confirmBox()

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

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

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

Parameters

host

ModalDialogHost

The modal host, including its translation service.

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
import { createApplication, confirmBox } from '@jsvision/ui';
import { resolveCapabilities } from '@jsvision/core';

const caps = resolveCapabilities().profile;
const app = createApplication({ caps });

async function save(): Promise<void> {
  // Persist the buffer to disk.
}

const answer = await confirmBox(app, 'The file has been modified. Save?');
if (answer === 'yes') await save();