Pre-caching with Workbox
Earlier in this book, I covered the concept of pre-caching assets within the install event. The standard pattern used is to create a list of URLs to cache and pass those to the cache.addAll method. This is great when your application is very stable and rarely changes assets. But what if you only need to update a handful of the pre-cached responses?
Instead of using the cache.addAll method, you need to create more sophisticated routines to check revisions against cached assets and perform updates.
This is where the Workbox precaching module is helpful. It abstracts the complex logic required to manage your pre-cached assets. You can still supply a simple array of URLs, as I have demonstrated in previous chapters, and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access