Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@ampproject/amp-sw
Advanced tools
Readme
AMP service worker is a service worker library for your AMP documents.
Purpose: Enhance network resiliency and optimize AMP asset reuse for AMP documents.
Core use cases:
stale-while-revalidate
strategy for a longer duration than the default http response headers indicate.To take advantage of AMP service worker, you'll need to host a resource loaded into the browser. Start by following these steps:
amp-install-serviceworker
(https://amp.dev/documentation/components/amp-install-serviceworker) to your AMP documents and point it your service worker file.
e.g.<amp-install-serviceworker
src="https://www.your-domain.com/serviceworker.js"
data-iframe-src="https://www.your-domain.com/install-serviceworker.html"
layout="nodisplay">
</amp-install-serviceworker>
importScripts('https://cdn.ampproject.org/sw/amp-sw.js');
AMP_SW.init();
AMP_SW.init({
assetCachingOptions: [{
regexp: /\.(png|jpg|woff2|woff|css|js)/,
cachingStrategy: 'CACHE_FIRST',
}],
offlinePageOptions: {
url: '/offline.html',
assets: [],
},
});
The AMP service worker is built up of the following modules:
link rel=prefetch
. You can use this to prefetch links and serve them from the service worker cache for the next time.While amp-sw
is divided into smaller sub modules, the core funationality of this project relies on the Workbox project. The amp-sw
modules also extend parts of the Workbox project.
FAQs
A service worker library to turn your AMP pages into PWA with network resiliency.
The npm package @ampproject/amp-sw receives a total of 100 weekly downloads. As such, @ampproject/amp-sw popularity was classified as not popular.
We found that @ampproject/amp-sw demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.