text: /* eslint-disable no-restricted-globals */
  var CACHE_NAME = "version3";
  var urlsToCache = ["/"];
  
  // Install a service worker
  self.addEventListener("install", (event) => {
      // Perform install steps
      event.waitUntil(
          caches
              .open(CACHE_NAME)
              .then(function (cache) {
                  console.log("Opened cache");
                  return cache.addAll(urlsToCache);
              })
              .then(() => self.skipWaiting())
      );
  });
  
  // Cache and return requests
  self.addEventListener("fetch", (event) => {
      event.respondWith(
          caches.match(event.request).then(function (response) {
              // Cache hit - return response
              if (response) {
                  return response;
              }
              return fetch(event.request);
          })
      );
  });
  
  // Update a service worker
  self.addEventListener("activate", (event) => {
      var cacheWhitelist = ["version3"];
      event.waitUntil(
          caches.keys().then((cacheNames) => {
              return Promise.all(
                  cacheNames.map((cacheName) => {
                      if (cacheWhitelist.indexOf(cacheName) === -1) {
                          return caches.delete(cacheName);
                      }
                  })
              );
          })
      );
  });
  