MDN self-hosted library · e01.org

ServiceWorkerRegistration: updatefound event

Service Workers API

Service Workers API

The updatefound event of the ServiceWorkerRegistration interface is fired any time the ServiceWorkerRegistration.installing property acquires a new service worker.

Syntax

Use the event name in addEventListener():

addEventListener("updatefound", (event) => { })

Alternatively, assign to the event handler property of the interface:

onupdatefound = (event) => { }

Event type

A generic Event.

Examples

const registration = await navigator.serviceWorker.getRegistration();
if (registration) {
  registration.addEventListener("updatefound", () => {
    console.log("Service Worker update found!");
  });
}

Specifications

Browser compatibility

See also