Most notification api's in various places have various ways to make the notifications either go away after some time, or to replace a notification, and if there is a bunch of them if they automatically stack up and then after some threshold the oldest ones go away.
So proposing to extend the JS notification api:
1) An expiry timeout after which the notification fades away
2) Allow an id to be set on the notification, if a new notification comes in with the same id as an existing on it deletes it and adds the new one to the top. (Even better might be an animation to move it to the top as its contents is replaced)
3) There is also valid use cases for when a notification could be removed. Although if this is required it may be better to use the de-duplicating above to replace it with something else.
4) The notification system could have some sort of maximum queue, eg 5 notifications, and if this is exceeded then the oldest one is automatically removed