ServiceWorkerContainer: getRegistrations() method
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The getRegistrations() method of the
ServiceWorkerContainer interface gets all
ServiceWorkerRegistrations associated with a
ServiceWorkerContainer, in an array. The method returns a
Promise that resolves to an array of
ServiceWorkerRegistration.
Syntax
js
getRegistrations()
Parameters
None.
Return value
A Promise that resolves to an array of
ServiceWorkerRegistration objects.
Examples
js
navigator.serviceWorker.getRegistrations().then((registrations) => {
document.querySelector("#status").textContent =
"ServiceWorkerRegistrations found.";
});
Specifications
| Specification |
|---|
| Service Workers> # navigator-service-worker-getRegistrations> |
Browser compatibility
Loading…