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.
- on
- Implemented types
Properties
- active → ServiceWorker?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- installing → ServiceWorker?
-
no setter
-
no setter
- onupdatefound ↔ EventHandler?
-
getter/setter pair
- pushManager → PushManager
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → String
-
no setter
- updateViaCache → ServiceWorkerUpdateViaCache
-
no setter
- waiting → ServiceWorker?
-
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