@nextcloud/dialogs
    Preparing search index...

    Interface ServiceWorkerContainer

    The ServiceWorkerContainer interface of the Service Worker 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.

    MDN Reference

    interface ServiceWorkerContainer {
        controller: ServiceWorker | null;
        oncontrollerchange:
            | ((this: ServiceWorkerContainer, ev: Event) => any)
            | null;
        onmessage: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null;
        onmessageerror:
            | ((this: ServiceWorkerContainer, ev: MessageEvent) => any)
            | null;
        ready: Promise<ServiceWorkerRegistration>;
        addEventListener<K extends keyof ServiceWorkerContainerEventMap>(
            type: K,
            listener: (
                this: ServiceWorkerContainer,
                ev: ServiceWorkerContainerEventMap[K],
            ) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        dispatchEvent(event: Event): boolean;
        getRegistration(
            clientURL?: string | URL,
        ): Promise<ServiceWorkerRegistration | undefined>;
        getRegistrations(): Promise<readonly 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,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
        startMessages(): void;
    }

    Hierarchy (View Summary)

    Index
    controller: ServiceWorker | null

    The controller read-only property of the ServiceWorkerContainer interface returns a activated (the same object returned by null if the request is a force refresh (Shift + refresh) or if there is no active worker.

    MDN Reference

    oncontrollerchange: ((this: ServiceWorkerContainer, ev: Event) => any) | null
    onmessage: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null
    onmessageerror: ((this: ServiceWorkerContainer, ev: MessageEvent) => any) | null

    The ready read-only property of the ServiceWorkerContainer interface provides a way of delaying code execution until a service worker is active.

    MDN Reference

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      Returns boolean

    • The startMessages() method of the ServiceWorkerContainer interface explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g., sent via Client.postMessage()).

      MDN Reference

      Returns void