web api event
ServiceWorkerGlobalScope: notificationclose event
Secure contextAvailable in workers
The notificationclose event of the ServiceWorkerGlobalScope interface fires when a user closes a displayed notification spawned by showNotification().
Notifications created on the main thread or in workers which aren’t service workers
using the Notification() constructor will
instead receive a close event on the Notification object
itself.
This event is not cancelable and does not bubble.
Syntax
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("notificationclose", (event) => { })
onnotificationclose = (event) => { }
Event type
A NotificationEvent. Inherits from ExtendableEvent and Event.
Example
// Inside a service worker.
self.onnotificationclose = (event) => {
console.log("On notification close: ", event.notification.tag);
};
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.