4. Resource Caching

In Chapter 3, “Service Workers,” we added a service worker to a web app and learned all about the service worker lifecycle. The service worker didn’t do much of anything, but at least we got one working in the app. In this chapter, we cover many of the ways you can cache web app content using a service worker.

Web apps use a cache for two reasons: to speed up app loading and so the app, or parts of the app, function when the system running the app does not have network connectivity. Launching a web app using cached resources is one of the things that makes Progressive Web Apps (PWAs) perform more like native mobile apps. When the app UI appears quickly, users don’t mind too much if it takes a little longer to populate the ...

Get Learning Progressive Web Apps: Building Modern Web Apps Using Service Workers 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.