/* eslint-env serviceworker */
(function () {
  'use strict';
  var CACHE_VERSION = 'v1';

  self.addEventListener('install', function (event) {
    event.waitUntil(
      caches.open(CACHE_VERSION)
    );
  });

  self.addEventListener('fetch', function (event) {
    event.respondWith(
      caches.match(event.request).then(function (resp) {
        return resp || fetch(event.request).then(function (response) {
          caches.open(CACHE_VERSION).then(function (cache) {
            cache.put(event.request, response.clone());
          });
          return response;
        });
      }).catch(function () {
        console.log('not in cache');
      })
    );
  });

  self.addEventListener('activate', function (event) {
    var cacheWhitelist = [CACHE_VERSION];

    event.waitUntil(
      caches.keys().then(function (keyList) {
        return Promise.all(keyList.map(function (key) {
          if (cacheWhitelist.indexOf(key) === -1) {
            return caches.delete(key);
          }
        }));
      })
    );
  });
})();

/* eslint-env serviceworker */
(function () {
  'use strict';
  var CACHE_VERSION = 'v3';

  self.addEventListener('install', function (event) {
    event.waitUntil(
      caches.open(CACHE_VERSION)
    );
  });

  self.addEventListener('fetch', function (event) {
    event.respondWith(
      caches.match(event.request).then(function (resp) {
        return resp || fetch(event.request).then(function (response) {
          caches.open(CACHE_VERSION).then(function (cache) {
            cache.put(event.request, response.clone());
          });
          return response;
        });
      }).catch(function () {
        console.log('not in cache');
      })
    );
  });

  self.addEventListener('activate', function (event) {
    var cacheWhitelist = [CACHE_VERSION];

    event.waitUntil(
      caches.keys().then(function (keyList) {
        return Promise.all(keyList.map(function (key) {
          if (cacheWhitelist.indexOf(key) === -1) {
            return caches.delete(key);
          }
        }));
      })
    );
  });
})();

--- 
+++ 
@@ -1,7 +1,7 @@
 /* eslint-env serviceworker */
 (function () {
   'use strict';
-  var CACHE_VERSION = 'v3';
+  var CACHE_VERSION = 'v1';
 
   self.addEventListener('install', function (event) {
     event.waitUntil(
refactor: Replace version v3 with v1

