Notifications
Description
We added a sleek notification api with a lot of possibilites. Play around with the form to try it out!
Firing a notification in your code is as simple as:
notification.fire('This is a notification');
Available options for a single notification
notification.fire('This is a notification', {
autoHide: false,
playSound: true,
duration: 5000,
style: 'default',
});
Notifications need to be initalized before you can use them. It's as simple as:
const notifications = new window.notifications();
There comes a set of options you can override on initialization.
const notifications = new window.notifications({
notificationSound: '../dist/media/notification.mp3',
volume: 0.2,
notification: {
autoHide: false,
playSound: true,
duration: 5000,
style: 'default',
position: 'top',
}
});
Demo