Alert ‹ Chocolat API

Alert.show(title, message, buttons)

Shows an alert.

  • title String – the title of your alert.
  • message String – the body of your alert message. Optional.
  • buttons Array – an array of buttons to display. Buttons are displayed from right to left.

Returns Number – the index of the button that was clicked. 0 is the right-most button. Optional.

Example

Alert.show("My Title", "My awesome body!", ["Yes", "No"]);

Alert.beep()

Play the system beep sound.

Alert.notify(options)

Show a user notification on 10.8. Notifications are ignored on 10.7.

  • options Object – an object of options to configure the notification. See example.

Example

Alert.notify({
    title: "Acheivement Unlocked",
    subtitle: "Go To Hell",
    body: "Use the goto keyword 10 times in the same file",
    button: "Revert",
    callback: function () {
        // Do something when the "Revert" button is clicked
    }
});