BackgroundFetchRecord

Limited availability

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

Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die BackgroundFetchRecord-Schnittstelle der Background Fetch API repräsentiert eine individuelle Anfrage und Antwort.

Ein BackgroundFetchRecord wird durch die Methode BackgroundFetchRegistration.matchAll() erstellt, weshalb es keinen Konstruktor für diese Schnittstelle gibt.

Es wird ein BackgroundFetchRecord für jede Ressource geben, die mit fetch() angefordert wird.

Instanz-Eigenschaften

request Schreibgeschützt Experimentell

Gibt ein Request zurück.

responseReady Schreibgeschützt Experimentell

Gibt ein Versprechen zurück, das mit einer Response aufgelöst wird.

Beispiele

In diesem Beispiel wird ein individuelles BackgroundFetchRecord unter Verwendung von BackgroundFetchRegistration.matchAll() zurückgegeben. Die BackgroundFetchRecord.request und BackgroundFetchRecord.responseReady werden zurückgegeben und in der Konsole protokolliert.

js
bgFetch.match("/ep-5.mp3").then(async (record) => {
  if (!record) {
    console.log("No record found");
    return;
  }

  console.log(`Here's the request`, record.request);
  const response = await record.responseReady;
  console.log(`And here's the response`, response);
});

Spezifikationen

Specification
Background Fetch
# background-fetch-record-interface

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
BackgroundFetchRecord
Experimental
request
Experimental
responseReady
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.