text: var Cache = true;
  var CACHE_NAME = 'PWA-CACHE';
  self.addEventListener("activate", event => {
    const cacheWhitelist = [CACHE_NAME];
    event.waitUntil(
      caches.keys()
        .then(keyList =>
          Promise.all(keyList.map(key => {
            if (!cacheWhitelist.includes(key)) {
              console.log('Deleting cache: ' + key)
              return caches.delete(key);
            }
          }))
        )
    );
  });
  self.addEventListener('install', function(event) {
    if (Cache) {
      event.waitUntil(
        caches.open(CACHE_NAME)
          .then(function(cache) {
            fetch("asset-manifest.json")
              .then(response => {
                response.json()
              })
              .then(assets => {
                const urlsToCache = [
                  "/",
                  assets["index.js"]
                ]
                cache.addAll(urlsToCache)
                console.log('cached');
              })
          })
      );
    }
  });
  self.addEventListener('fetch', function(event) {
      if (Cache) {
        event.respondWith(
            caches.match(event.request).then(function(response) {
                return response || fetch(event.request);
            })
        );
      }
  });
  