const addToCache = (request, networkResponse) => {
  return caches.open('playbulb-candle')
    .then((cache) => cache.put(request, networkResponse.clone()));
};

const getCacheResponse = (request) => {
  return caches.open('playbulb-candle').then((cache) => {
    return cache.match(request);
  });
};

const getNetworkOrCacheResponse = (request) => {
  return new Promise((resolve) => {
    fetch(request).then((networkResponse) => {
      addToCache(request, networkResponse);
      resolve(networkResponse);
    }).catch(() => {
      getCacheResponse(request).then((cacheResponse) => {
        resolve(cacheResponse || Response.error());
      });
    });
  });
};

self.addEventListener('fetch', (event) => {
  event.respondWith(getNetworkOrCacheResponse(event.request));
});

const cleanOldCache = () => {
  return caches.keys().then(cacheNames => {
    return Promise.all(
      cacheNames.filter(cacheName => (cacheName !== 'playbulb-candle'))
                .map(cacheName => caches.delete(cacheName))
    );
  })
}

self.addEventListener('activate', (event) => {
  event.waitUntil(cleanOldCache());
});

@@ -1,13 +1,16 @@
-const
+function
  addToCa
@@ -12,19 +12,16 @@
 dToCache
- = 
 (request
@@ -34,27 +34,24 @@
 orkResponse)
- =%3E
  %7B%0A  return 
@@ -145,32 +145,34 @@
 clone()));%0A%7D
-;
 %0A%0A
-const
+function
  getCacheRes
@@ -168,35 +168,32 @@
 getCacheResponse
- = 
 (request) =%3E %7B%0A 
@@ -177,35 +177,32 @@
 esponse(request)
- =%3E
  %7B%0A  return cach
@@ -286,24 +286,26 @@
 %0A  %7D);%0A%7D
-;
 %0A%0A
-const
+function
  getNetw
@@ -322,19 +322,16 @@
 Response
- = 
 (request
@@ -331,19 +331,16 @@
 request)
- =%3E
  %7B%0A  ret
@@ -649,17 +649,16 @@
 %0A  %7D);%0A%7D
-;
 %0A%0Aself.a
@@ -767,13 +767,16 @@
 );%0A%0A
-const
+function
  cle
@@ -789,16 +789,10 @@
 ache
- = () =%3E
+()
  %7B%0A 

Use function instead of const (#57)