Web/API/NotificationEvent/NotificationEvent

From Get docs

Draft This page is not complete.


The NotificationEvent() constructor creates a new NotificationEvent object.

Syntax

var myNotificationEvent = 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.

Example

var n = new Notification('Hello');
var init = { notification: n };
var myNotificationEvent = new NotificationEvent(type, init);

Specifications

Specification Status Comment
Notifications APIThe definition of 'NotificationEvent() constructor' in that specification. Living Standard Living standard.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

NotificationEvent() constructor

Experimental'

Chrome

Full support 42

Edge

Full support ≤18

Firefox Full support 44

Notes'

Full support 44

Notes'

Notes' Extended Support Releases (ESR) before Firefox 78 ESR do not support service workers and the Push API.

IE

No support No

Opera

Full support 37

Safari

?

WebView Android

No support No

Chrome Android

Full support 42

Firefox Android

Full support 44

Opera Android

Full support 37

Safari iOS

?

Samsung Internet Android

Full support 4.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.
See implementation notes.'
See implementation notes.