Created
December 6, 2019 23:14
-
-
Save kmaraz/c180c5dad9c6af825521688a7f76ec69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workbox.routing.registerRoute( | |
new RegExp('/things$'), | |
new workbox.strategies.StaleWhileRevalidate({ | |
cacheName: 'api-things', | |
plugins: [ | |
new workbox.broadcastUpdate.Plugin({ | |
channelName: 'api-updates', | |
headersToCheck: ['x-checksum'], // Or other headers | |
}), | |
new workbox.expiration.Plugin({ | |
maxEntries: 50, | |
maxAgeSeconds: 30 * 24 * 60 * 60, | |
purgeOnQuotaError: true | |
}), | |
], | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment