Note: This feature is only available in Service Workers.
The NotificationEvent() constructor creates a new NotificationEvent object.
new NotificationEvent(type, options)typeA string with the name of the event. It is case-sensitive and browsers set it to notificationclick or notificationclose.
optionsAn object that, in addition of the properties defined in ExtendableEvent(), can have the following properties:
notificationA Notification object to be used as the notification the event is dispatched on.
action OptionalAn action associated with the notification. It defaults to "".
A new NotificationEvent() object.
const n = new Notification("Hello");
const myNotificationEvent = new NotificationEvent(type, { notification: n });