SwUpdate
Subscribe to update notifications from the Service Worker, trigger update checks, and forcibly activate updates.
class SwUpdate {
versionUpdates: Observable<VersionEvent>
unrecoverable: Observable<UnrecoverableStateEvent>
isEnabled: boolean
checkForUpdate(): Promise<boolean>
activateUpdate(): Promise<boolean>
}
See also
Provided in
Properties
Property | Description |
---|---|
versionUpdates: Observable<VersionEvent>
|
Read-Only
Emits a Emits a Emits a |
unrecoverable: Observable<UnrecoverableStateEvent>
|
Read-Only
Emits an |
isEnabled: boolean
|
Read-Only
True if the Service Worker is enabled (supported by the browser and enabled via
|
Methods
checkForUpdate() |
---|
Checks for an update and waits until the new version is downloaded from the server and ready for activation. |
ParametersThere are no parameters. Returns
|
activateUpdate() |
---|
Updates the current client (i.e. browser tab) to the latest version that is ready for activation. |
ParametersThere are no parameters. Returns
|
In most cases, you should not use this method and instead should update a client by reloading the page. Updating a client without reloading can easily result in a broken application due to a version mismatch between the application shell and other page resources, such as lazy-loaded chunks, whose filenames may change between versions. Only use this method, if you are certain it is safe for your specific use case. |