### activateUpdate() Source: https://angular.io/api/service-worker/SwUpdate Updates the current client to the latest available version that is ready for activation. Use with caution. ```APIDOC ## activateUpdate() Updates the current client (i.e. browser tab) to the latest version that is ready for activation. ```typescript activateUpdate(): Promise ``` ### Returns `Promise`: Resolves to `true` if an update was activated successfully, `false` if no update was available, or rejects if an error occurs. **Note:** In most cases, reloading the page is the recommended way to activate updates. Use this method only if you are certain it is safe for your specific use case, as it can lead to application instability due to version mismatches. ``` -------------------------------- ### checkForUpdate() Source: https://angular.io/api/service-worker/SwUpdate Checks for a new version of the application and waits for it to be downloaded and ready for activation. ```APIDOC ## checkForUpdate() Checks for an update and waits until the new version is downloaded from the server and ready for activation. ```typescript checkForUpdate(): Promise ``` ### Returns `Promise`: Resolves to `true` if a new version was found and is ready, `false` if no new version was found, or rejects if an error occurs. ``` -------------------------------- ### SwUpdate Class Overview Source: https://angular.io/api/service-worker/SwUpdate This snippet shows the basic structure of the SwUpdate class, including its observable properties and methods. ```APIDOC ## SwUpdate class final Subscribe to update notifications from the Service Worker, trigger update checks, and forcibly activate updates. ```typescript class SwUpdate { versionUpdates: Observable unrecoverable: Observable isEnabled: boolean checkForUpdate(): Promise activateUpdate(): Promise } ``` ``` -------------------------------- ### Properties Source: https://angular.io/api/service-worker/SwUpdate Details on the observable properties and boolean flag available in the SwUpdate class. ```APIDOC ## Properties * `versionUpdates: Observable`: Read-Only. Emits events related to version detection, download failures, and readiness for activation. * `unrecoverable: Observable`: Read-Only. Emits an event when the Service Worker is in an unrecoverable state requiring a full page reload. * `isEnabled: boolean`: Read-Only. Indicates if the Service Worker is enabled in the browser and configured via `ServiceWorkerModule`. ``` -------------------------------- ### Activate Service Worker Update Source: https://angular.io/api/service-worker/SwUpdate Forcibly updates the current client to the latest available version that has been downloaded and is ready for activation. Use with caution, as it can lead to application instability if not handled carefully. It's generally recommended to reload the page instead. ```typescript activateUpdate(): Promise ``` -------------------------------- ### Check for Service Worker Update Source: https://angular.io/api/service-worker/SwUpdate Checks if a new version of the application is available from the service worker. It waits for the new version to be downloaded and prepared for activation. Use this to proactively check for updates. ```typescript checkForUpdate(): Promise ``` -------------------------------- ### SwUpdate Class Definition Source: https://angular.io/api/service-worker/SwUpdate Defines the SwUpdate class with its observable properties for version updates and unrecoverable states, and its methods for checking and activating updates. This class is provided by the ServiceWorkerModule. ```typescript class SwUpdate { versionUpdates: Observable unrecoverable: Observable isEnabled: boolean checkForUpdate(): Promise activateUpdate(): Promise } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.