BackgroundFetchRecord: thuộc tính responseReady
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Note: This feature is available in Web Workers.
Thuộc tính chỉ đọc responseReady của giao diện BackgroundFetchRecord trả về một Promise phân giải với một Response.
Giá trị
Ví dụ
Trong ví dụ này, một BackgroundFetchRecord riêng lẻ được trả về bằng BackgroundFetchManager.fetch(). Giá trị của responseReady được trả về và ghi ra console.
js
bgFetch.match("/ep-5.mp3").then(async (record) => {
if (!record) {
console.log("No record found");
return;
}
const response = await record.responseReady;
console.log(`Here's the response`, response);
});
Thông số kỹ thuật
| Specification |
|---|
| Background Fetch> # dom-backgroundfetchrecord-responseready> |