1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00

Formatted some files

This commit is contained in:
K4USTU3H 2019-12-11 22:40:27 +05:30
parent c247ead4f4
commit 85835e6167
No known key found for this signature in database
GPG key ID: 00B12ABC9EE9D58D
7 changed files with 224 additions and 252 deletions

View file

@ -1,42 +1,42 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js');
importScripts(
"https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js"
);
if (workbox) {
workbox.setConfig({
debug: false
});
if (workbox) {
workbox.setConfig({
debug: false
});
var 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
} else {
return null
}
}
);
var 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
} else {
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()
);
} else {
console.log(`No workbox on this browser 😬`);
}
workbox.routing.registerRoute(
new RegExp(/.*\.(?:png|jpg|jpeg|svg|gif|webp)/g),
workbox.strategies.cacheFirst()
);
} else {
console.log(`No workbox on this browser 😬`);
}