Notification
Create and display a Notification
Example:
// Create and display new Notification instance
var myNotification = new Notification({
title: "Title",
id: "myNotification",
timerDuration: "10s",
buttonLabel: "The Best Button",
onClick: function () {
pages.goto('the-best-page')
},
onTimeout: function () {
new Say({label: "You ran out of time."})
}
})
// Change notification title in 1.5 seconds.
setTimeout(function() {myNotification.setTitle('A better Title')}, 1500)
Optional String. Id to use with Notification.get(id)
Optional String. HTML (xss filtered) to display in the bubble. No title if falsy.
Optional String or Number. (Required for onTimeout) If number, number of ms for timer to run. If string, '1s' = 1 second, '1m' one minute, etc.
Optional Function. Called when timer is complete. Notification is removed.
Optional String. HTML (xss filtered) to display in the button. No button if falsy.
Optional Function. Called when button is clicked. Notification is removed.
Optional Function. Called when notification has been rendered and is ready. Passes notification's abstracted HTMLElement to function.
Example
var myNotification = new Notification({
title: 'A title',
ready: function(e) {
e.innerHTML = '<div>I will replace everything in this notification.</div>'
}
})
Return array of all active notification ids
Return notification instance for given id
Remove notification. Do not run onTimeout or onClick.
Return id for given notification instance
Update the button label for the notification
Update the title for the notification
Get notification's abstracted HTMLElement. (Note: Not all standard HTMLElement methods and properties are available, but many are.)