web api instance method
BackgroundFetchManager: get() method
Limited availabilityAvailable in workers
The get() method of the BackgroundFetchManager interface returns a Promise that resolves with the BackgroundFetchRegistration associated with the provided id or undefined if the id is not found.
Syntax
get(id)
Parameters
id- : The ID of a
BackgroundFetchRegistrationdefined by callingfetch().
- : The ID of a
Return value
A Promise that resolves with a BackgroundFetchRegistration or undefined.
Examples
The following examples shows how to use get() to retrieve a BackgroundFetchRegistration. With an active service worker, use the backgroundFetch to access the BackgroundFetchManager object and call its get() method.
navigator.serviceWorker.ready.then(async (swReg) => {
const bgFetch = await swReg.backgroundFetch.get("my-fetch");
});
// my code block
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.