AMP Service worker
AMP service worker is a service worker library for your AMP pages.
The project aims to bring network resiliency and other network related optimizations to any AMP page which is being controlled by this service worker. Core use cases:
- Cache AMP scripts with a
stale-while-revalidatestrategy for a longer duration that http-headers.
- Cache valid visited AMP documents, and serve only in case of flaky network conditions.
- Cache assets which are critical to a page with a given strategy.
- Prefetch outgoing links from an AMP page.
- Cache an offline page in order to show when a user navigates to a page which was previously not visited.
In order to use this library user can include the library with an importScript in their service worker
The AMP service worker is built up of the following modules:
- AMP caching module
- Document caching module
- Asset caching module
- Link prefetch module
- Offline page module
The description of each module and their configuration options can be found inside their respective folder's README.