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 ...

Get Progressive Web Application Development by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.