text: self.addEventListener("install",e=>{
      console.log("Installing!");
      e.waitUntil(
          caches
              .open(cache_name)
              .then(cache => {
                  return cache.addAll(assets);
              })
              .catch(err => console.log(err))
      );
  })
  
  self.addEventListener('fetch', function(event) {
      event.respondWith(async function() {
         try{
           var res = await fetch(event.request);
           var cache = await caches.open('cache');
           cache.put(event.request.url, res.clone());
           return res;
         }
         catch(error){
           return caches.match(event.request);
          }
        }());
    });