Skip to main content
Module

x/evt/lib/index.ts>dom.ServiceWorkerContainer

💧EventEmitter's typesafe replacement
Go to Latest
interface dom.ServiceWorkerContainer
implements EventTarget
import { type dom } from "https://deno.land/x/evt@v2.3.1/lib/index.ts";
const { ServiceWorkerContainer } = dom;

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.

Properties

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>

Methods

getRegistration(clientURL?: string): Promise<ServiceWorkerRegistration | undefined>
getRegistrations(): Promise<ReadonlyArray<ServiceWorkerRegistration>>
register(scriptURL: string, options?: RegistrationOptions): Promise<ServiceWorkerRegistration>
startMessages(): void
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
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