Skip to content

Instantly share code, notes, and snippets.

@Chalarangelo
Created July 17, 2017 13:26
Show Gist options
  • Save Chalarangelo/3e74acdae08ed94abf897ad98b87baed to your computer and use it in GitHub Desktop.
Save Chalarangelo/3e74acdae08ed94abf897ad98b87baed to your computer and use it in GitHub Desktop.
var cacheName = 'mockApp-v1.0.0';
var filesToCache = [
'./',
'./index.html',
'./manifest.json',
'./static/js/bundle.js'
];
self.addEventListener('install', function(e) {
e.waitUntil(caches.open(cacheName)
.then(function(cache) {
return cache.addAll(filesToCache)
.then(function() {
self.skipWaiting();
});
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment