Skip to content

Instantly share code, notes, and snippets.

@thangman22
Created September 23, 2022 15:33
Show Gist options
  • Save thangman22/92cec7d6838597dfbd29ae4f73da2ab4 to your computer and use it in GitHub Desktop.
Save thangman22/92cec7d6838597dfbd29ae4f73da2ab4 to your computer and use it in GitHub Desktop.
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js'
)
workbox.routing.registerRoute(
new workbox.routing.Route(({ request }) => {
return request.url.includes('/generate')
},
new workbox.strategies.CacheFirst({
// Use a custom cache name.
cacheName: 'postr-download',
plugins: [new workbox.expiration.ExpirationPlugin({
maxAgeSeconds: 3600
})]
})
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment