Library for sending notifications to end users.
Properties
autoHideLimit :numberstatic
#
Maximum number of simultaneous notifications to start auto-hide timers for. Only this number of notifications being displayed will be auto-hidden at one time. Any additional notifications in the list will only start counting their timeout for auto-hiding after the previous messages have been closed.
This basically represents the minimal number of notifications the user should
be able to process during the default
autoHideSeconds
time.
Type:
autoHideSeconds :Object.<string, number>static
#
Map of predefined auto-hide timeout keys to second values. short
is
used by default, and other values can be added for use in #notify
.
Type:
Properties:
defaults :mw.notification.NotificationOptionsstatic
#
The defaults for #notify
options parameter.
Type:
#notify
options parameter.
Methods
notify(message, [options]) → {Notification}static
#
Display a notification message to the user.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
HTMLElement | Array.<HTMLElement> | jQuery | mw.Message | string | ||
options |
mw.notification.NotificationOptions |
optional |
The options to use
for the notification. Options not specified default to the values in
|
Returns:
Notification object
- Type
- Notification
pause()static
#
Pause auto-hide timers for all notifications. Notifications will not auto-hide until resume is called.
- Source:
- See:
resume()static
#
Resume any paused auto-hide timers from the beginning.
Only the first mw.notification.autoHideLimit
timers will be resumed.
Type Definitions
NotificationOptions
#
Type:
Properties:
Name | Type | Description |
---|---|---|
autoHide |
boolean | Whether the notification should automatically be hidden after shown. Or if it should persist. |
autoHideSeconds |
string | Key to
|
tag |
string
|
null
|
When a notification is tagged only one message with that tag will be displayed. Trying to display a new notification with the same tag as one already being displayed will cause the other notification to be closed and this new notification to open up inside the same place as the previous notification. |
title |
string
|
null
|
Title for the notification. Will be displayed above the content. Usually in bold. |
type |
string
|
null
|
The type of the message used for styling.
Examples: |
visibleTimeout |
boolean | Whether the autoHide timeout should be based on time the page was visible to user. Or if it should use wall clock time. |
id |
string
|
false
|
HTML ID to set on the notification element. |
classes |
string
|
Array.<string>
|
false
|
CSS class names to be set on the notification element. |