Member Junction
    Preparing search index...

    Implements

    • OnDestroy
    Index

    Constructors

    Accessors

    • get isServiceWorkerEnabled(): boolean

      True if the underlying SwUpdate API is active (SW registered + supported).

      Returns boolean

    • get lastVersionEvent(): VersionReadyEvent | null

      The most recent VERSION_READY event, if any. Useful for diagnostics.

      Returns VersionReadyEvent | null

    • get updateAvailable$(): Observable<boolean>

      Emits true once a new SW-cached version is ready to activate. Stays true until either applyUpdate() (which reloads the page) or dismissForSession() (which resets the flag without reloading).

      Returns Observable<boolean>

    Methods

    • Reload the page to activate the newly-downloaded SW version.

      Implementation note: the SW activates new versions on the next navigation, not via any in-process API. So we just reload — SwUpdate doesn't expose a non-reload way to swap the running JS without losing application state, and any such mechanism would be unsafe anyway.

      This method is split out (vs. inlining location.reload()) so consumers can be tested without actually reloading the page.

      Returns void

    • Manually nudge the SW to check for an update. The Angular SW polls automatically on a schedule, but consumers can call this to force an immediate check (e.g., from a "Check for updates" menu item).

      Returns true if a new version was found and downloaded; false if we're already on the latest. Resolves to false if the SW is disabled.

      Returns Promise<boolean>

    • Dismiss the prompt for this session without reloading. The flag will re-fire on the next page load if the SW is still pointing at the pending version (which it will be, until something triggers a reload).

      Use case: a power user is in the middle of editing something and doesn't want to interrupt; they'll get prompted again on their next reload.

      Returns void

    • A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.

      Returns void

    • Indirection for test injection — overriding location.reload directly is not possible in a JSDOM/happy-dom environment without warnings, and spying on globalThis.location is brittle. This wrapper lets tests mock the reload via a subclass / vi.spyOn(service as any, 'performReload').

      Returns void

    • Start a periodic update check on the given interval. Called automatically by the constructor with DEFAULT_POLL_INTERVAL_MS. Consumers may call this again with a different interval to retune at runtime — the previous timer is cleared first.

      Pass 0 (or any non-positive number) to disable periodic checking. Polling is automatically suspended while the tab is hidden and resumed (with an immediate check) when the tab becomes visible again.

      Parameters

      • intervalMs: number

      Returns void