Alert
Ask a question, get an answer
Blocks until the person taps something, then returns the index of the action they chose, or -1 if dismissed. In-app only: a widget cannot present anything and the call fails at once. Check isAvailable.
Properties
isAvailableBooleanFalse in a widget.
Methods
Alert.present(title, message?, actions?)StringA modal alert. Actions default to ["OK"]. Returns the tapped action's label.
- title String required
- message String
- actions [String]
returns The label of the tapped action, or null when the alert was dismissed without one.
Alert.sheet(title, message?, actions?)StringThe same as an action sheet. The last action is treated as the cancel one.
- title String required
- message String
- actions [String]
returns The label of the tapped action, or null when the alert was dismissed without one.
Examples
Confirming
var choice = Alert.present("Delete?", "This cannot be undone.", ["Delete", "Cancel"]);
if (choice === "Delete") { Storage.delete("draft"); }