Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

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

This ServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.

Properties

readonly
active: ServiceWorker | null
readonly
installing: ServiceWorker | null
readonly
navigationPreload: NavigationPreloadManager
onupdatefound: ((this: ServiceWorkerRegistration, ev: Event) => any) | null
readonly
pushManager: PushManager
readonly
scope: string
readonly
sync: SyncManager
readonly
updateViaCache: ServiceWorkerUpdateViaCache
readonly
waiting: ServiceWorker | null

Methods

getNotifications(filter?: GetNotificationOptions): Promise<Notification[]>
showNotification(title: string, options?: NotificationOptions): Promise<void>
unregister(): Promise<boolean>
update(): Promise<void>
addEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
type: K,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
type: K,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void