Sending Notifications

The Notifications() class provides an Application() implementation which makes it easy to display contextual notifications to clients. There should only be a singleton instance of this class, so rather than creating your own instance please use the existing instance which is available as ui.notifications.

class Notifications(options)

A common framework for displaying notifications to the client. Submitted notifications are added to a queue, and up to 3 notifications are displayed at once. Each notification is displayed for 5 seconds at which point further notifications are pulled from the queue.

Examples:

ui.notifications.info("This is an info message");
ui.notifications.warn("This is a warning message");
ui.notifications.error("This is an error message");
ui.notifications.info("This is a 4th message which will not be shown until the first info message is done");
Notifications.active

type: Array

Notifications which are currently displayed

Notifications.defaultOptions

Configure the default behavior of the notifications application

Notifications.error(message)

Display a notification with the “error” type

Arguments:
  • message (String) – The content of the notification message
Notifications.info(message)

Display a notification with the “info” type

Arguments:
  • message (String) – The content of the notification message
Notifications.notify(message, type)

Push a new notification into the queue

Arguments:
  • message (String) – The content of the notification message
  • type (String) – The type of notification, currently “info”, “warning”, and “error” are supported
Notifications.queue

type: Array

Submitted notifications which are queued for display

Notifications.warn(message)

Display a notification with the “warning” type

Arguments:
  • message (String) – The content of the notification message