ServiceWorker class

This ServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. Available only in secure contexts.

MDN Reference

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

ServiceWorker()
factory

Properties

addEventListener → ({void Function<K$ extends Event>(AbstractWorkerEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on AbstractWorker, provided by the AbstractWorker$Typings extension

Overload accessor: $1, $2
no setter
addEventListener ↔ void Function(String, [Object?, Object?])

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
addEventListener → ({void Function<K$>(ServiceWorkerEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

Overload accessor: $1, $2
no setter
dispatchEvent bool Function(Event)

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
onerror ↔ dynamic Function(ErrorEvent)?

Available on AbstractWorker, provided by the AbstractWorker$Typings extension

MDN Reference
getter/setter pair
onstatechange ↔ dynamic Function(Event)?

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

MDN Reference
getter/setter pair
postMessage → ({void Function(List<Object> transfer, [dynamic message]) $1, void Function([dynamic message, StructuredSerializeOptions? options]) $2})

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

Overload accessor: $1, $2
no setter
removeEventListener → ({void Function<K$ extends Event>(AbstractWorkerEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on AbstractWorker, provided by the AbstractWorker$Typings extension

Overload accessor: $1, $2
no setter
removeEventListener ↔ void Function(String, [Object?, Object?])

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
removeEventListener → ({void Function<K$>(ServiceWorkerEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

Overload accessor: $1, $2
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scriptURL String

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

MDN Reference
no setter
state ServiceWorkerState

Available on ServiceWorker, provided by the ServiceWorker$Typings extension

MDN Reference
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited