ServiceWorkerRegistration extension type
The ServiceWorkerRegistration
interface of the
Service Worker API
represents the service worker registration. You register a service worker to
control one or more pages that share the same origin.
The lifetime of a service worker registration is beyond that of the
ServiceWorkerRegistration
objects that represent them within the lifetime
of their corresponding service worker clients. The browser maintains a
persistent list of active ServiceWorkerRegistration
objects.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Properties
- active → ServiceWorker?
-
The
active
read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state isactivating
oractivated
. This property is initially set tonull
.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- installing → ServiceWorker?
-
The
installing
read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state isinstalling
. This property is initially set tonull
.no setter -
The
navigationPreload
read-only property of the ServiceWorkerRegistration interface returns the NavigationPreloadManager associated with the current service worker registration.no setter - onupdatefound ↔ EventHandler?
-
getter/setter pair
- pushManager → PushManager
-
The
pushManager
read-only property of the ServiceWorkerRegistration interface returns a reference to the PushManager interface for managing push subscriptions; this includes support for subscribing, getting an active subscription, and accessing push permission status.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → String
-
The
scope
read-only property of the ServiceWorkerRegistration interface returns a string representing a URL that defines a service worker's registration scope; that is, the range of URLs a service worker can control. This is set using thescope
parameter specified in the call to ServiceWorkerContainer.register which registered the service worker.no setter - sync → SyncManager
-
The
sync
read-only property of the ServiceWorkerRegistration interface returns a reference to the SyncManager interface, which manages background synchronization processes.no setter - updateViaCache → ServiceWorkerUpdateViaCache
-
The
updateViaCache
read-only property of the ServiceWorkerRegistration interface returns the value of the setting used to determine the circumstances in which the browser will consult the HTTP cache when it tries to update the service worker or any scripts that are imported via WorkerGlobalScope.importScripts.no setter - waiting → ServiceWorker?
-
The
waiting
read-only property of the ServiceWorkerRegistration interface returns a service worker whose ServiceWorker.state isinstalled
. This property is initially set tonull
.no setter
Methods
-
addEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
addEventListener()
method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.inherited -
dispatchEvent(
Event event) → bool -
The
dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually withdispatchEvent()
.inherited -
getNotifications(
[GetNotificationOptions filter]) → JSPromise< JSArray< Notification> > -
The
getNotifications()
method of the ServiceWorkerRegistration interface returns a list of the notifications in the order that they were created from the current origin via the current service worker registration. Origins can have many active but differently-scoped service worker registrations. Notifications created by one service worker on the same origin will not be available to other active service workers on that same origin. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.inherited -
showNotification(
String title, [NotificationOptions options]) → JSPromise< JSAny?> -
The
showNotification()
method of the ServiceWorkerRegistration interface creates a notification on an active service worker. -
toString(
) → String -
A string representation of this object.
inherited
-
unregister(
) → JSPromise< JSBoolean> -
The
unregister()
method of the ServiceWorkerRegistration interface unregisters the service worker registration and returns aPromise
. The promise will resolve tofalse
if no registration was found, otherwise it resolves totrue
irrespective of whether unregistration happened or not (it may not unregister if someone else just called ServiceWorkerContainer.register with the same scope.) The service worker will finish any ongoing operations before it is unregistered. -
update(
) → JSPromise< JSAny?> -
The
update()
method of the ServiceWorkerRegistration interface attempts to update the service worker. It fetches the worker's script URL, and if the new worker is not byte-by-byte identical to the current worker, it installs the new worker. The fetch of the worker bypasses any browser caches if the previous fetch occurred over 24 hours ago.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited