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

View in English Always switch to English

BackgroundFetchRegistration:downloaded 属性

Limited availability

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

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

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

BackgroundFetchRecord 接口的只读属性 downloaded 返回已下载的字节数,初始值为 0

如果此属性的值发生变化,则会在关联的 BackgroundFetchRegistration 对象上触发 progress 事件。

number

示例

访问该属性以获取已下载的字节数,并将其打印在控制台中。

js
console.log(bgFetch.downloaded);

规范

Specification
Background Fetch
# dom-backgroundfetchregistration-downloaded

浏览器兼容性