ServiceWorkerContainer extension type
The ServiceWorkerContainer
interface of the
Service Worker API
provides an object representing the service worker as an overall unit in the
network ecosystem, including facilities to register, unregister and update
service workers, and access the state of service workers and their
registrations.
Most importantly, it exposes the ServiceWorkerContainer.register method used to register service workers, and the ServiceWorkerContainer.controller property used to determine whether or not the current page is actively controlled.
- on
- Implemented types
Properties
- controller → ServiceWorker?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- oncontrollerchange ↔ EventHandler?
-
getter/setter pair
- onmessage ↔ EventHandler?
-
getter/setter pair
- onmessageerror ↔ EventHandler?
-
getter/setter pair
-
ready
→ JSPromise<
ServiceWorkerRegistration> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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 -
getRegistration(
[String clientURL]) → JSPromise< ServiceWorkerRegistration?> -
The
getRegistration()
method of the ServiceWorkerContainer interface gets a ServiceWorkerRegistration object whose scope URL matches the provided client URL. The method returns aPromise
that resolves to a ServiceWorkerRegistration orundefined
. -
getRegistrations(
) → JSPromise< JSArray< ServiceWorkerRegistration> > -
The
getRegistrations()
method of the ServiceWorkerContainer interface gets all ServiceWorkerRegistrations associated with aServiceWorkerContainer
, in an array. The method returns aPromise
that resolves to an array of ServiceWorkerRegistration. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
String scriptURL, [RegistrationOptions options]) → JSPromise< ServiceWorkerRegistration> -
The
register()
method of the ServiceWorkerContainer interface creates or updates a ServiceWorkerRegistration for the givenscriptURL
. -
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 -
startMessages(
) → void -
The
startMessages()
method of the ServiceWorkerContainer interface explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g. sent via Client.postMessage). This can be used to react to sent messages earlier, even before that page's content has finished loading. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited