This page contains examples for some of the Workbox modules.
Workbox is a set of small modules that can be used on their own, but we've
also combined the most common pieces into one module,
workbox-sw. This module
supports precaching, routing of fetch events, runtime caching and more.
workbox-sw example demonstrates a complete service worker
implementation, demonstrating the common parts of the API. It's an in-depth
exploration of everything you'd need to build a production-ready service worker.
Lower Level Modules
As an alternative to using the full
workbox-sw library, you can use these
smaller, standalone modules in your service worker.
Uses the Broadcast Channel API to let you know when two responses are different.
Takes care of expiring cached entries based on the maximum number or age of entries.
Makes it easy to handle network requests using the response strategy of your choice.
Implements common cache strategies, and provides hooks to extend the default behaviors.