Member Junction
    Preparing search index...

    Options for configuring MJServiceWorkerModule.forRoot().

    interface MJServiceWorkerOptions {
        enabled: boolean;
        pollIntervalMs?: number;
        registrationStrategy?: string;
        scriptPath?: string;
    }
    Index

    Properties

    enabled: boolean

    Master enable flag — when false, no service worker is registered and SwUpdate.isEnabled resolves to false. The toast component is always exported, but it renders nothing when SW is disabled.

    Wire this to something like environment.production && environment.enableServiceWorker so dev builds and ops kill-switches both turn it off cleanly.

    pollIntervalMs?: number

    How often (in ms) UpdateNotificationService should ask the SW to check for a new manifest while the tab is visible. Defaults to 15 minutes. Pass 0 to disable periodic checking entirely (the SW's internal poll still runs, but on a much longer cadence — typically hours).

    Note: this is wired by UpdateNotificationService itself in its constructor; we don't currently provide a DI token for it. To override at runtime, inject UpdateNotificationService and call service.startAutoCheck(yourIntervalMs).

    registrationStrategy?: string

    Registration strategy passed to ServiceWorkerModule.register. Defaults to 'registerWhenStable:30000' — defer registration until the app is idle for 30s OR 30s have elapsed, whichever first. Avoids competing with initial app boot for network bandwidth.

    scriptPath?: string

    The path to the generated SW worker script, relative to the deployed app root. Defaults to 'ngsw-worker.js' (the Angular CLI default). Override only if you've customized the build output.