The NotificationEvent()
constructor creates a new NotificationEvent
object.
NotificationEvent()
Syntax
new NotificationEvent(type, NotificationEventInit);
Parameters
-
type
-
TBD
-
NotificationEventInit
Optional -
A dictionary object containing a
Notification
object to be used as the notification the event is dispatched on. In later drafts of the specification, this parameter is not optional.
Examples
var n = new Notification('Hello'); var init = { notification: n }; var myNotificationEvent = new NotificationEvent(type, init);
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
NotificationEvent |
42
|
17
|
44
Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.
|
No
|
37
|
No
|
No
|
42
|
44
|
37
|
No
|
4.0
|
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/NotificationEvent/NotificationEvent