The getRegistration()
method of the ServiceWorkerContainer
interface gets a ServiceWorkerRegistration
object whose scope URL matches the provided client URL. The method returns a Promise
that resolves to a ServiceWorkerRegistration
or undefined
.
serviceWorkerContainer.getRegistration(clientURL).then(function(serviceWorkerRegistration) { });
A Promise
that resolves to a ServiceWorkerRegistration
object or undefined
.
navigator.serviceWorker.getRegistration('/app').then(function(registration) {
if(registration){
document.querySelector('#status').textContent = 'ServiceWorkerRegistration found.';
}
});