register method

JSPromise<ServiceWorkerRegistration> register(
  1. JSAny scriptURL, [
  2. RegistrationOptions options
])

The register() method of the ServiceWorkerContainer interface creates or updates a ServiceWorkerRegistration for the given scriptURL.

If successful, a service worker registration ties the provided script URL to a scope, which is subsequently used for navigation matching. You can call this method unconditionally from the controlled page. I.e., you don't need to first check whether there's an active registration.

Implementation

external JSPromise<ServiceWorkerRegistration> register(
  JSAny scriptURL, [
  RegistrationOptions options,
]);