Docs (4.0.0)
class GlobalContext method

showConfirmDialogAsync

Displays a confirmation dialog with the specified text and buttons.

showConfirmDialogAsync(config: ConfigOptions.Arg<MessageDialogOptions> | LazyString | string | StringConvertible[], confirmLabel?: StringConvertible, cancelLabel?: StringConvertible): Promise<boolean | 0>

Notes

  • Use strf to translate content if necessary; this method doesn’t localize strings by default.

Parameters

  • config — An instance of MessageDialogOptions; or a callback function to set options for the dialog to be displayed; or one or more messages to be displayed
  • confirmLabel — The label for the confirm button (if a single message was provided instead of an options object or callback)
  • cancelLabel — The label for the cancel button (if a single message was provided instead of an options object or callback)

Return value

A promise that resolves to true if the confirm button was clicked, false if cancelled, or the number 0 if the alternative option is selected (if any).

Errors

  • This method throws an error if the theme modal dialog controller can’t be initialized (i.e. there’s no current theme, or the theme doesn’t support modal dialog views).

Related