Angular JS 6 Service Worker Lifecycle
What Is a Service Worker Life Cycle?
If you have worked with Service Workers, A service worker has a life cycle that is completely separate from your web apps page. Angular service worker in your project, use the CLI command
ng add @angular/pwa
The Angular service worker's behavior follows that design goal:
- Caching an application is like installing a native application. The application is cached as one unit, and all files update together.
- A running application continues to run with the same version of all files. It does not suddenly start receiving cached files from a newer version, which are likely incompatible.
- When users refresh the application, they see the latest fully cached version. New tabs load the latest cached code.
- Updates happen in the background, relatively quickly after changes are published. The previous version of the application is served until an update is installed and ready.
- The service worker conserves bandwidth when possible. Resources are only downloaded if they've changed.
0 comments:
Post a Comment