ServiceWorkerRegistration
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. Available only in secure contexts.
interface ServiceWorkerRegistration extends EventTarget {
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 updateViaCache: ServiceWorkerUpdateViaCache;
readonly waiting: ServiceWorker | null;
addEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
type: K,
listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;getNotifications(filter?: GetNotificationOptions): Promise<Notification[]>;
removeEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
type: K,
listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;unregister(): Promise<boolean>;
update(): Promise<void>;
}var ServiceWorkerRegistration: {
prototype: ServiceWorkerRegistration;
new (): ServiceWorkerRegistration;
};§Extends
§Properties
§
readonly active: ServiceWorker | null
[src]§
readonly installing: ServiceWorker | null
[src]§
onupdatefound: ((this: ServiceWorkerRegistration, ev: Event) => any) | null
[src]§
readonly pushManager: PushManager
[src]§
readonly updateViaCache: ServiceWorkerUpdateViaCache
[src]§
readonly waiting: ServiceWorker | null
[src]§Methods
§
addEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
[src]type: K,
listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
getNotifications(filter?: GetNotificationOptions): Promise<Notification[]>
[src]§
removeEventListener<K extends keyof ServiceWorkerRegistrationEventMap>(
[src]type: K,
listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void