I am using angular-web-notification . My problem is that if I open 2 browser tabs and then the messages are received, I get to see two instances of notifications shown.
Below is the reference code.
webNotification.showNotification(title, {
body: body,
onClick: function onNotificationClicked() {
console.log('Notification clicked.');
},
icon: 'icon.png'
}, function onShow(error, hide) {
if (error) {
console.log('Unable to show notification: ' + error.message);
} else {
console.log('Notification Shown.');
}
});
Do you have any ideas?
To prevent any duplicate notification use Tag
Notification.tag The ID of the notification https://developer.mozilla.org/en-US/docs/Web/API/notification