precaching
Downloading and caching a list of essential files during a service worker's install step, so the app can load offline from the start.
In more detail
The list of files is usually generated at build time and versioned with the service worker. Precache the app shell, such as HTML, CSS, scripts and icons, and cache other responses at runtime as they are requested.
Related terms
- service worker lifecycle — The states a service worker passes through: installing, installed and waiting, activating, activated, and finally redundant when replaced or failed.
- Cache Storage API — A browser storage API that saves pairs of Request and Response objects in named caches, usually managed by a service worker.
- static asset — A file served exactly as stored, such as an image, stylesheet, font or script bundle, rather than generated for each request.
Taught in
- Service Worker Lifecycle: Installation, Activation And Update — Frontend Architecture & Web Platform