- Sw-toolbox:github
- It provides a cononical implementation of all the runtime caching strategies so you need for your dynamice content.
- Sw-precache:github
- It takes care of caching and maintaing all the resources in your app Shell
- Sw-helpers:github
- Lighthouse:github
- https://developers.google.com/web/tools/service-worker-libraries/?hl=en
- Application-shell
- Code Lab
Sw-toolbox:
For the assets, you can use Cache-first:
Cachefirst, would go to cache for fetching data, if there was then return the cache back, would not go to network fo R fetching data.
If cannot get the data from the cache and then fallback to network to get data.
Toolbox.router. Get ( '/path/to/images/.*', Toolbox.cachefirst, {cache: { 'images', 6 // cache at most 6 images }})
For highly dynamic data, can use Network first: (Battle Lie-fi)
Networkfirst, would go network for fetching data, if get the data then return to back.
If cannot get the data, then fallback to cache.
Toolbox.router. Get ( '/posts/.*', toolbox.networkfist, {cache: { 'posts', 5 - - },
Networktimeoutseconds:3//After three sconds, fallback to cache
})
Fastest:
Race between Cache and network:
[IO PWA] Great libraries and tools for great Progressive Web Apps