JavaScript Notifications API Notification events


The Notification API specifications support 2 events that can be fired by a Notification.

  1. The click event.

This event will run when you click on the notification body (excluding the closing X and the Notifications configuration button).


notification.onclick = function(event) {
    console.debug("you click me and this is my event object: ", event);
  1. The error event

The notification will fire this event whenever something wrong will happen, like being unable to display

notification.onerror = function(event) {
    console.debug("There was an error: ", event);