Open ShivamChaurasia opened 6 years ago
There is an open PR (#39) to address this that will make this easier. However, I needed to clear all the notifications too, what I did as a workaround was to trigger an event when you changed the route.
If you check the source, you can see that after clicking the notification, it will trigger the requestHide
. So, in my onRouteChange
I add something like this:
const notifications = [].slice.call(document.querySelectorAll('.notification'))
notifications.forEach(notification => notification.click())
This will simulate a click event for each of the notifications, and hence, closing them. I hope that helps.
NotificationManager.listNotify.forEach(n => NotificationManager.remove({ id: n.id }));
i think this is a 'cleaner' workaround.
Would be nice to have a call that clears all notifications which had no timeOut.