ServiceWorker
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.
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
readonly state: ServiceWorkerState;
addEventListener<K extends keyof ServiceWorkerEventMap>(
type: K,
listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;removeEventListener<K extends keyof ServiceWorkerEventMap>(
type: K,
listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
}type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;var ServiceWorker: {
prototype: ServiceWorker;
new (): ServiceWorker;
};§Properties
§
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null
[src]§
readonly state: ServiceWorkerState
[src]§Methods
§
addEventListener<K extends keyof ServiceWorkerEventMap>(
[src]type: K,
listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
removeEventListener<K extends keyof ServiceWorkerEventMap>(
[src]type: K,
listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void