Skip to main content

alert

caution

This is outdated, feel free to contribute to the docs and update this page. Otherwise it'll get updated in a few weeks.

View code source alert is an invocable that creates an alert. There are three approaches you can use to create one.

Usage

import alert from "42/ui/invocables/alert.js"
const approach1: boolean = await alert(string, object)
const approach2: boolean = await alert(object)
const approach3: boolean = await alert(object)

Approach 1

First argument is a string, and second argument is an object

PropertyTypeDescriptionDefault
messageStringMessage to be displayed in alert""

Approach 2

First argument is error-like

PropertyTypeDescriptionDefault
messageError-likeMessage to be displayed in alert
optionsObjectSee below for properties

Options

This is an extension of the dialog options | Name | Type | Description | agree | String | text for the "Ok" button | beforeAgree | String/Plan/HTMLElement | Content to be rendered to the left of the "Ok" button | afterAgree | String/Plan/HTMLElement | Content to be rendered to the right of the "Ok button

Approach 3

First argument is an object (not error-like)

PropertyTypeDescription
messageStringMessage to be displayed in alert

Returns

true