Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ServiceWorkerContainer

The ServiceWorkerContainer interface of the ServiceWorker 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. Available only in secure contexts.

interface ServiceWorkerContainer extends EventTarget {
readonly controller: ServiceWorker | null;
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null;
onmessage: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null;
onmessageerror: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null;
readonly ready: Promise<ServiceWorkerRegistration>;
addEventListener<K extends keyof ServiceWorkerContainerEventMap>(
type: K,
listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void;
getRegistration(clientURL?: string | URL): Promise<ServiceWorkerRegistration | undefined>;
getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>;
register(scriptURL: string | URL, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>;
removeEventListener<K extends keyof ServiceWorkerContainerEventMap>(
type: K,
listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void;
startMessages(): void;
}
var ServiceWorkerContainer: {};

§Extends

§Properties

§
readonly controller: ServiceWorker | null
[src]
§
oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null
[src]
§
onmessage: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null
[src]
§
onmessageerror: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null
[src]
§
readonly ready: Promise<ServiceWorkerRegistration>
[src]

§Methods

§
addEventListener<K extends keyof ServiceWorkerContainerEventMap>(
type: K,
listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
getRegistration(clientURL?: string | URL): Promise<ServiceWorkerRegistration | undefined>
[src]
§
getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>
[src]
§
register(scriptURL: string | URL, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>
[src]
§
removeEventListener<K extends keyof ServiceWorkerContainerEventMap>(
type: K,
listener: (this: ServiceWorkerContainer, ev: ServiceWorkerContainerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]
§
startMessages(): void
[src]