Synchronous accessor for current update-available state.
The most recent VERSION_READY event, if any. Useful for diagnostics.
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).
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.
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.
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.
A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.
ProtectedperformIndirection 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').
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.
Stop the periodic poll started by startAutoCheck().
True if the underlying SwUpdate API is active (SW registered + supported).