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

//create a message
var message = AP.messages.info('plain text title', 'plain text body');

This module is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Methods

clear(id)

Close a message

Parameters:
Name Type Description
id String

The id that was returned when the message was created.

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

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

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

Show an error message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.error('title', 'error message example');

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

Show a generic message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.generic('title', 'generic message example');

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

Show a hint message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.hint('title', 'hint message example');

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

Show an info message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.info('title', 'info message example');

onClose(id, callback)

Trigger an event when a message is closed

Parameters:
Name Type Description
id String

The id that was returned when the message was created.

callback function

The function that is run when the event is triggered

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Example
//create a message
var message = AP.messages.info('title', 'body');
AP.messages.onClose(message, function() {
  console.log(message, ' has been closed!');
});

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

Show a success message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.success('title', 'success message example');

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

Show a warning message

Parameters:
Name Type Description
title String

Sets the title text of the message.

body String

The main content of the message.

options Object

Message Options

Properties
Name Type Description
closeable Boolean

Adds a control allowing the user to close the message, removing it from the page.

fadeout Boolean

Toggles the fade away on the message

delay Number

Time to wait (in ms) before starting fadeout animation (ignored if fadeout==false)

duration Number

Fadeout animation duration in milliseconds (ignored if fadeout==false)

This method is deprecated and will be removed after August 2017.

Please use the Flag module instead.

Returns:

The id to be used when clearing the message

String
Example
//create a message
var message = AP.messages.warning('title', 'warning message example');