PushMessageData.json()

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

PushMessageData (en-US) 接口的 **json()**方法将推送消息数据提取为 一个 JSON 对象。

Syntax

js
let massage_Json = PushEvent.data.json();

Parameters

None.

Returns

A JSON object.

Examples

js
self.addEventListener("push", function (event) {
  var jsonObj = event.data.json();

  // do something with your JSON
});

Specifications

Specification
Push API
# dom-pushmessagedata-json

Browser Compatibility

BCD tables only load in the browser

See also