Notification module for handling breaking news / live banners and on site notifications
- Source:
Properties:
Name | Type | Description |
---|---|---|
selector |
String | DOM selector for notification UI |
labelSelector |
String | DOM selector for notification label element |
closeButtonSelector |
String | DOM selector for notification close button |
headlineSelector |
String | DOM selector for notification headline element |
linkSelector |
String | DOM selector for notification link element |
videoSelector |
String | DOM selector for notification video element |
videoTypeCss |
String | CSS class for signaling notification with video |
activeCss |
String | CSS class for an active notification |
hidingCss |
String | CSS class for a notification is hiding |
headerAdCss |
String | CSS class for the header ad element |
whiteClass |
String | CSS class for white icon color |
blackClass |
String | CSS class for black icon color |
ajaxUrl |
String | Ajax base URL for fetching notification data |
cookieName |
String | Cookie name storing notification viewing and dismissal data |
invertTypes |
Array | alert types that requires button SVG inverted |
$notifcation |
Element | DOM reference to the notification UI |
$closeButton |
Element | DOM reference to the notification close button |
$headline |
Element | DOM reference to the notification headline |
$label |
Element | DOM reference to the notification label |
$links |
Element | DOM reference to the notification a tags |
video |
Object | reference to a SimpleVideo |
currentItem |
Object | Object storing data for the current notification item displayed |
windowTitle |
String | title of the window document |
POLLING_TIMEOUT |
Integer | Timeout for continuously polling for notifications in ms |
REFETCH_TIMEOUT |
Integer | Timeout for requesting notifications upon item dimissal in ms |
INITIAL_TIMEOUT |
Integer | Timeout for initial request of notifications in ms |
Methods
(inner) broadcast(event)
- Source:
Fire custom event to window object
Parameters:
Name | Type | Description |
---|---|---|
event |
name of custom event |
(inner) disableVideoControls()
- Source:
Disable video keyboard controls once the video renders Users can't pause/play/turn on volume inside notification so they have to click it to get to the article with the video
(inner) handleResponse(result)
- Source:
Handle returned notification items from ajax call
Parameters:
Name | Type | Description |
---|---|---|
result |
String | JSON parsable string |
(inner) init()
- Source:
Set up event handler notification interactions and schedule request for getting notifications
(inner) request()
- Source:
Ajax request for getting notification items
(inner) resetCurrentItem()
- Source:
Resets current item. If item has a video, stop playback.
(inner) scheduleRequest(timeout)
- Source:
Schedule a notifications request in timeout milliseconds
Parameters:
Name | Type | Description |
---|---|---|
timeout |
int | timeout in milliseconds |
(inner) setup()
- Source:
Setup event listener to trigger initial notification request when sticky ad closes.