Precaching
One of the key aspects of the PRPL pattern, which we will learn more about in a later chapter, is to store application assets when the application is installed. When a user accesses an initial entry point to a web application, a background process is triggered that will automatically load additional assets that will later be needed as different aspects of the site are rendered. This is known as precaching, or priming your application's cache for better performance in the future.
Service workers make this practice easy to manage. You can take advantage of the install and activate events, as well as when a service worker is initially triggered. The common practice is to use the install event when a new service worker is registered ...
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