此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

BackgroundFetchEvent:registration 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

备注: 此特性仅在 Service Worker 中可用。

BackgroundFetchEvent 接口的只读属性 registration 返回一个 BackgroundFetchRegistration 对象。

BackgroundFetchRegistration 对象。

示例

在此示例中,如果用户单击显示下载进度的用户界面,则会触发 backgroundfetchclick 事件。通过调用 event.registration 返回当前的 BackgroundFetchRegistration

js
addEventListener("backgroundfetchclick", (event) => {
  console.log(event.registration);
});

规范

Specification
Background Fetch
# dom-backgroundfetchevent-registration

浏览器兼容性