Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/yxz/typing/lib.dom.ts>ServiceWorker

Deno Standard Extensions
Go to Latest
interface ServiceWorker
import { type ServiceWorker } from "https://deno.land/x/yxz@0.17.0/typing/lib.dom.ts";

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.

Properties

onstatechange: ((this: ServiceWorker, ev: Event) => any) | null
readonly
scriptURL: string
readonly
state: ServiceWorkerState

Methods

postMessage(message: any, transfer: Transferable[]): void
postMessage(message: any, options?: StructuredSerializeOptions): void
addEventListener<K extends keyof ServiceWorkerEventMap>(
type: K,
listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
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,
options?: boolean | EventListenerOptions,
): void