jQuery.telligent.evolution.notifications
This module adds support for showing temporary notifications in the top right of the browser's viewport. Multiple messages are stacked.
Methods
addFilter
Adds a client-side filter to prevent the raising of client messages about new notifications. Returns a specific id for the filter handler.
$.telligent.evolution.notifications.addFilter(notificationTypeId, handler);
options:
notificationTypeId
: The notification type ID to filterhandler
: callback called before a notification message is raised. Passed the notification data. Returning true allows the notification message to be raised. Returning false prevents it. If a handler is not provided, the default behavior is to prevent all messages of the notification type id.
#### removeFilter
Removes a client-side filter notification filter.
$.telligent.evolution.notifications.addFilter(notificationTypeId, filterId);
options:
notificationTypeId
: The notification type ID for which to remove the filtersfilterId
: When provided, removes only the specific handler matching the filter ID (returned from addFilter). When not provided, all handlers for the notification type id are removed.
clearFilters
Clears all notification filters.
$.telligent.evolution.notifications.clearFilters();
show
Shows the provided HTML message in the notifications area of the page. Returns the unique ID of the notification message.
$.telligent.evolution.notifications.show(message, options);
options:
-
duration
: the number of milliseconds to show the message. While hovered, messages stay visible even if the duration has passed.- default:
5000
- default:
-
width
: the width of the notification in pixels- default:
200
- default:
-
type
: the textual CSS message type (success, warning, error)- default:
empty
- default:
-
id
: a unique ID for the message. If one is not provided, one will be generated. IDs can passed in and re-used in order to alter the content of an already-displayed message.- default:
null
(auto-generated)
- default:
onClick
: callback called when the message is clicked. When anonClick
handler is provided, the message has an different styling when hovered overonClose
: callback called when the message is explicitly closed by the user. When onClose returns a promise, the message is not closed until the promise resolves.onShow
: callback called when the message is shownonHide
: callback called when the message disappears either automatically or explicitlyonOver
: callback called when the mouse is over the messageonOut
: callback called when the mouse leaves the message
hide
Hides a single notification message by its id
$.telligent.evolution.notifications.hide(id);
Hides all open notifications and execute a callback function
$.telligent.evolution.notifications.hide(callback);
unread
Updates or adjusts unread counts to or by value. The value can be an explicit value or a + or - prefixed value to represent an offset.
$.telligent.evolution.notifications.unread(value, options);
options:
isLocal
: the value applies only to the current tab/window.namespace
: the namespace of the component applying the unread change.
Retrieves the count of unread items as an object: { local: 2, global: 2 }
$.telligent.evoution.notifications.unread();