Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zippytyro committed Jan 28, 2021
1 parent 95b1480 commit a8fa53d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions service-worker.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
// jshint esversion:6
// importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js');

// workbox.routing.registerRoute(
// ({request})=> request.destination === "image",
// new workbox.strategies.CacheFirst()
// );
const CACHE = 'Simon-game';
const cacheWhitelist = ['Simon-game'];
// Installing service workker
const CACHE_NAME = 'Simon-game';
let resourcesToCache = ["./", "./img/game.png", "./game.js", "./sounds/wrong.mp3", "./sounds/blue.mp3", "./sounds/green.mp3", "./sounds/red.mp3", "./sounds/yellow.mp3", "./styles.css"];
// To install a service worker

self.addEventListener("install", e=>{
e.waitUntil(
caches.open(CACHE).then(cache =>{
caches.open(CACHE_NAME).then(cache =>{
return cache.addAll(resourcesToCache);
})
);
Expand All @@ -27,6 +22,7 @@ self.addEventListener("fetch", e=>{
});

// Update a service worker
const cacheWhitelist = ['Simon-game'];
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(cacheNames => {
Expand Down

1 comment on commit a8fa53d

@vercel
Copy link

@vercel vercel bot commented on a8fa53d Jan 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.