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
.
serviceWorkerContainer.getRegistrations().then(function(serviceWorkerRegistrations) { });
A Promise
that resolves to an array of ServiceWorkerRegistration
objects.
navigator.serviceWorker.getRegistrations().then(function(registrations) {
document.querySelector('#status').textContent = 'ServiceWorkerRegistrations found.';
});