ServiceWorkerContainer.getRegistrations()
The getRegistrations()
method of the
ServiceWorkerContainer
interface gets all
ServiceWorkerRegistration
s associated with a
ServiceWorkerContainer
, in an array. The method returns a
Promise
that resolves to an array of
ServiceWorkerRegistration
.
Syntax
serviceWorkerContainer.getRegistrations().then(function(serviceWorkerRegistrations) { ... });
Parameters
None.
Return value
A Promise
that resolves to an array of
ServiceWorkerRegistration
objects.
Example
navigator.serviceWorker.getRegistrations().then(function(registrations) {
document.querySelector('#status').textContent = 'ServiceWorkerRegistrations found.';
});
Specifications
Specification | Status | Comment |
---|---|---|
Service Workers The definition of 'getRegistrations()' in that specification. |
Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser