push

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

The push event is fired to indicate that a Service Worker has received a push message.

General info

Specification
Push API
Interface
PushEvent
Bubbles
No
Cancelable
No
Target
Service worker
Default Action
None

Properties

data
Provides access to the data payload of a push message, contained in a PushMessageData object.

Examples

self.addEventListener('push', function(event) {
  var obj = event.data.json();
  port.postMessage(obj);
});

pushsubscriptionchange

See also

文档标签和贡献者