Documentation

messages

Messages are the primary method for providing system feedback in the product user interface. Messages include notifications of various kinds: alerts, confirmations, notices, warnings, info and errors. For visual examples of each kind please see the Design guide.

Example

AP.require("messages", function(messages){ //create a message var message = messages.info('plain text title', 'plain text body'); });

Classes

MessageOptions

Methods

clear(id)

clear a message

Parameters:
NameTypeDescription
idString

The id that was returned when the message was created.

Example
AP.require("messages", function(messages){ //create a message var message = messages.info('title', 'body'); setTimeout(function(){ messages.clear(message); }, 2000); });

error(title, body, options) → {String}

Show an error message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.error('title', 'error message example'); });

generic(title, body, options) → {String}

Show a generic message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.generic('title', 'generic message example'); });

hint(title, body, options) → {String}

Show a hint message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.hint('title', 'hint message example'); });

info(title, body, options) → {String}

Show an info message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.info('title', 'info message example'); });

success(title, body, options) → {String}

Show a success message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.success('title', 'success message example'); });

warning(title, body, options) → {String}

Show a warning message

Parameters:
NameTypeDescription
titleString

Sets the title text of the message.

bodyString

The main content of the message.

optionsMessageOptions

Message Options

Returns:

The id to be used when clearing the message

String
Example
AP.require("messages", function(messages){ //create a message var message = messages.warning('title', 'warning message example'); });