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?)NumberA modal alert. Actions default to ["OK"]. Returns the tapped index.
- title String required
- message String
- actions [String]
Alert.sheet(title, message?, actions?)NumberThe same as an action sheet. The last action is treated as the cancel one.
- title String required
- message String
- actions [String]
Examples
Confirming
var choice = Alert.present("Delete?", "This cannot be undone.", ["Delete", "Cancel"]);
if (choice === 0) { Storage.delete("draft"); }