/utils/dialogs

The dialogs module exports alert and confirm methods which are bound to the window.alert() and window.confirm() browser functions.

The methods accept the same params as the mapp.ui.elements.alert() and mapp.ui.elements.confirm() methods. The ui module assigns the ui elements as mapp.utils.alert and mapp.utils.confirm when loaded.

MAPP modules must call mapp.utils.alert() and mapp.utils.confirm() so that they can be used without the MAPP.UI library.

Methods

(inner) alert(params)

The alert method shows the params text in a window.alert() browser dialog.

mapp.utils.alert({
  text: 'Drivetimes have been created.'
})
Parameters:
NameTypeDescription
paramsObject | string

Params for the alert dialog or the alert text.

Properties
NameTypeAttributesDescription
params.textstring<optional>

Text to display in the alert.

params.innerContentHTMLElement<optional>

Custom HTML whose text content is displayed if no text is provided.

(async, inner) confirm(params) → {Promise.<boolean>}

The confirm method shows the params text in a window.confirm() browser dialog.

The method resolves to the boolean response like the async mapp.ui.elements.confirm() method.

const confirmed = await mapp.utils.confirm({
  text: 'Please confirm changes.'
})
Parameters:
NameTypeDescription
paramsObject | string

Params for the confirm dialog or the confirm text.

Properties
NameTypeAttributesDescription
params.textstring<optional>

Text to display in the confirm dialog.

params.innerContentHTMLElement<optional>

Custom HTML whose text content is displayed if no text is provided.

Returns:

Resolves to true if the dialog was confirmed.

Type: 
Promise.<boolean>

(inner) dialogText(params) → {string}

The dialogText method returns the text for a browser dialog from the dialog params.

Parameters:
NameTypeDescription
paramsObject | string

Params for the dialog or the dialog text.

Returns:

The dialog text.

Type: 
string