update carbon-mini

This commit is contained in:
marlon-erler
2024-07-07 15:48:23 +02:00
parent e010de6a30
commit 42ea51c35e
3 changed files with 55 additions and 1 deletions
+16
View File
@@ -1,3 +1,4 @@
// TABS
document.querySelector("main").addEventListener("scroll", () => {
const links = document.querySelectorAll(".tab-link");
links.forEach((element) => element.removeAttribute("active"));
@@ -8,3 +9,18 @@ document.querySelector("main").addEventListener("scroll", () => {
if (links[currentPage]) links[currentPage].setAttribute("active", "");
});
// SERVICE WORKER
async function registerServiceWorker() {
if ("serviceWorker" in navigator) {
try {
await navigator.serviceWorker.register("/sw.js", {
scope: "/",
});
} catch (error) {
console.error(`Could not install service worker: ${error}`);
}
}
}
registerServiceWorker();