Skip to content

Instantly share code, notes, and snippets.

@Auwalms
Created May 26, 2019 19:21
Show Gist options
  • Save Auwalms/3f06f4f73210f27eaf74cbd8cb5ea094 to your computer and use it in GitHub Desktop.
Save Auwalms/3f06f4f73210f27eaf74cbd8cb5ea094 to your computer and use it in GitHub Desktop.
let Cache_Name = `Auwsum-Kitchen-1`;
let filesToCache = [
'/',
'/index.html',
'/styles/bootstrap.min.css',
'/styles/app.css',
'/scripts/jquery-3.3.1.slim.min.js',
'/scripts/bootstrap.min.js',
'/scripts/services.js',
'/scripts/app.js',
'/images/drink.png',
'/images/rice.jpg',
'/images/snack.jpg',
'/images/soup.png',
'/images/stew.jpg',
'/images/swallow.jpeg'
];
self.addEventListener("install", event => {
self.skipWaiting();
event.waitUntil(
caches.open(Cache_Name).then(cache => cache.addAll(filesToCache))
)
})
self.addEventListener("fetch", event => {
event.respondWith(
caches.match(event.request).then(response => response || fetch(event.request))
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment