46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
const rpgDicesVersion = "rpg-dices-v0.2.0"
|
|
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",
|
|
"/assets/dices/custom.svg",,
|
|
"/assets/icons/icon.svg",
|
|
]
|
|
|
|
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)
|
|
})
|
|
)
|
|
}) |