text: const CACHE_NAME = "seputarbola-v1";
  const urlsToCache = [
    "/",
    "/nav.html",
    "/index.html",
    "/detail-team.html",
    "/manifest.json",
    "/register-sw.js",
    "/push.js",
    "/pages/home.html",
    "/pages/team.html",
    "/pages/about.html",
    "/pages/saved.html",
    "/css/materialize.min.css",
    "/css/style.css",
    "/js/materialize.min.js",
    "/js/nav.js",
    "/js/api.js",
    "/js/btn-action.js",
    "/js/db.js",
    "/js/idb.js",
    "/js/notification.js",
    "/fonts/Lalezar-Regular.ttf",
    "/img/bg1.jpg",
    "/logo_text.png",
    "/icon-192x192.png",
    "/icon-512x512.png",
    "/maskable_icon-192x192.png",
    "/maskable_icon-512x512.png",
    "https://fonts.googleapis.com/icon?family=Material+Icons",
    "https://fonts.gstatic.com/s/materialicons/v67/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2"
  ];
  
  self.addEventListener("install", (event) => {
    event.waitUntil(
      caches.open(CACHE_NAME).then((cache) => {
        return cache.addAll(urlsToCache);
      })
    );
  });
  
  // Agar menghapus cache-cache lama
  self.addEventListener("activate", (event) => {
    event.waitUntil(
      caches.keys().then((cacheNames) => {
        return Promise.all(
          cacheNames.map((cacheName) => {
            if (cacheName != CACHE_NAME) {
              console.log("ServiceWorker: cache " + cacheName + " dihapus");
              return caches.delete(cacheName);
            }
          })
        );
      })
    );
  });
  
  // Menggunakan metode Stale While Revalidate
  self.addEventListener("fetch", (event) => {
    let base_url = "https://api.football-data.org/v2/";
    if (event.request.url.indexOf(base_url) > -1) {
      event.respondWith(
        caches.open(CACHE_NAME).then((cache) => {
          return fetch(event.request).then((response) => {
            cache.put(event.request.url, response.clone());
            return response;
          })
        })
      );
    } else {
      event.respondWith(
        caches.match(event.request, { ignoreSearch: true }).then((response) => {
          return response || fetch(event.request);
        })
      )
    }
  });
  
  self.addEventListener('push', function (event) {
    let body;
    if (event.data) {
      body = event.data.text();
    } else {
      body = 'Push message no payload';
    }
    let options = {
      body: body,
      icon: 'icon-192x192.png',
      vibrate: [100, 50, 100],
      data: {
        dateOfArrival: Date.now(),
        primaryKey: 1
      }
    };
    event.waitUntil(
      self.registration.showNotification('Push Notification', options)
    );
  });