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 insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
ThegetRegistrations() method of theServiceWorkerContainer interface gets allServiceWorkerRegistrations associated with aServiceWorkerContainer, in an array. The method returns aPromise that resolves to an array ofServiceWorkerRegistration.
In this article
Syntax
js
getRegistrations()Parameters
None.
Return value
APromise that resolves to an array ofServiceWorkerRegistration objects.
Examples
js
navigator.serviceWorker.getRegistrations().then((registrations) => { document.querySelector("#status").textContent = "ServiceWorkerRegistrations found.";});Specifications
| Specification |
|---|
| Service Workers Nightly> # navigator-service-worker-getRegistrations> |