mirror of
https://github.com/dilllxd/gitfolio.git
synced 2024-08-14 22:28:09 +00:00
Removed xo
This commit is contained in:
parent
566c7aea3a
commit
ee3ccb26ab
13 changed files with 478 additions and 469 deletions
|
@ -1,42 +1,42 @@
|
|||
importScripts(
|
||||
"https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js"
|
||||
"https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js"
|
||||
);
|
||||
|
||||
if (workbox) {
|
||||
workbox.setConfig({
|
||||
debug: false
|
||||
});
|
||||
workbox.setConfig({
|
||||
debug: false
|
||||
});
|
||||
|
||||
const defaultStrategy = workbox.strategies.networkFirst({
|
||||
cacheName: "fallback",
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxEntries: 128,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
|
||||
purgeOnQuotaError: true // Opt-in to automatic cleanup
|
||||
}),
|
||||
new workbox.cacheableResponse.Plugin({
|
||||
statuses: [0, 200] // For opague requests
|
||||
})
|
||||
]
|
||||
});
|
||||
workbox.routing.setDefaultHandler(args => {
|
||||
if (args.event.request.method === "GET") {
|
||||
return defaultStrategy.handle(args); // Use default strategy
|
||||
}
|
||||
const defaultStrategy = workbox.strategies.networkFirst({
|
||||
cacheName: "fallback",
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxEntries: 128,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
|
||||
purgeOnQuotaError: true // Opt-in to automatic cleanup
|
||||
}),
|
||||
new workbox.cacheableResponse.Plugin({
|
||||
statuses: [0, 200] // For opague requests
|
||||
})
|
||||
]
|
||||
});
|
||||
workbox.routing.setDefaultHandler(args => {
|
||||
if (args.event.request.method === "GET") {
|
||||
return defaultStrategy.handle(args); // Use default strategy
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:js|css)/g),
|
||||
workbox.strategies.networkFirst()
|
||||
);
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:js|css)/g),
|
||||
workbox.strategies.networkFirst()
|
||||
);
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
|
||||
workbox.strategies.cacheFirst()
|
||||
);
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
|
||||
workbox.strategies.cacheFirst()
|
||||
);
|
||||
} else {
|
||||
console.log("No workbox on this browser 😬");
|
||||
console.log("No workbox on this browser 😬");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue