rpg-dices/sw.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-05-05 18:56:02 +02:00
const rpgDicesVersion = "rpg-dices-v0.2.1"
2024-05-05 08:03:57 +02:00
const assets = [
"/",
"/index.html",
"/style.css",
"/script.js",
"/js/libs/moment.js",
"/js/libs/sidebar/sidebar.js",
"/js/libs/sidebar/sidebar.css",
"/assets/add.svg",
"/assets/close.svg",
"/assets/dark.svg",
"/assets/dices.svg",
"/assets/export.svg",
"/assets/history.svg",
"/assets/import.svg",
"/assets/light.svg",
"/assets/menu.svg",
"/assets/plus.svg",
"/assets/roll.svg",
"/assets/dices/4.svg",
"/assets/dices/6.svg",
"/assets/dices/8.svg",
"/assets/dices/10.svg",
"/assets/dices/12.svg",
"/assets/dices/20.svg",
"/assets/dices/100.svg",
2024-05-05 18:48:54 +02:00
"/assets/dices/custom.svg",,
"/assets/icons/icon.svg",
2024-05-05 08:03:57 +02:00
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(rpgDicesVersion).then(cache => {
cache.addAll(assets)
})
)
})
self.addEventListener("fetch", fetchEvent => {
fetchEvent.respondWith(
caches.match(fetchEvent.request).then(res => {
return res || fetch(fetchEvent.request)
})
)
})