mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
feat: use StaleWhileRevalidate for scripts poloicy; v1.104.2
This commit is contained in:
parent
d3ba6dd95b
commit
3d1f268003
5 changed files with 33 additions and 40 deletions
9
sw.js
9
sw.js
|
|
@ -1,7 +1,7 @@
|
|||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.2.0/workbox-sw.js");
|
||||
|
||||
const {Route, registerRoute} = workbox.routing;
|
||||
const {CacheFirst, NetworkFirst} = workbox.strategies;
|
||||
const {CacheFirst, NetworkFirst, StaleWhileRevalidate} = workbox.strategies;
|
||||
const {CacheableResponsePlugin} = workbox.cacheableResponse;
|
||||
const {ExpirationPlugin} = workbox.expiration;
|
||||
|
||||
|
|
@ -18,8 +18,11 @@ registerRoute(
|
|||
|
||||
registerRoute(
|
||||
({request, url}) =>
|
||||
request.destination === "script" && !url.pathname.endsWith("min.js") && !url.pathname.includes("versioning.js"),
|
||||
new CacheFirst({
|
||||
request.destination === "script" &&
|
||||
!url.pathname.endsWith("min.js") &&
|
||||
!url.pathname.includes("versioning.js") &&
|
||||
!url.contains("google"),
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: "fmg-scripts",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue