This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The PushEvent()
constructor creates a new PushEvent
object. Note that the this constructor is exposed only to a service worker context.
var myPushEvent = new PushEvent(type, eventInitDict);
DOMString
defining the type of PushEvent
. This can be push
or pushsubscriptionchange
.PushEvent
object with. The options are: data
: The data you want the PushEvent
to contain, if any. When the constructor is invoked, the PushEvent.data
property of the resulting object will be set to a new PushMessageData
object containing bytes extracted from the eventInitDict data
member.var dataInit = { data : 'Some sample text' } var myPushEvent = new PushEvent('push', dataInit); myPushEvent.data.text(); // should return 'Some sample text'
Specification | Status | Comment |
---|---|---|
Push API The definition of 'PushEvent' in that specification. | Working Draft | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 42.0 | 44.0 (44.0)[1][2] | No support | ? | No support |
data property | No support | 44.0 (44.0)[2] | No support | No support | No support |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | No support | No support | 48.0 (48)[3] | No support | No support | No support | No support | 42.0 |
data property | No support | No support | 48.0 (48)[3] | No support | No support | No support | No support | No support |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PushEvent/PushEvent