Created
March 11, 2018 23:41
-
-
Save ritikrishu/4f9e47cea551e5b40b10134709938b18 to your computer and use it in GitHub Desktop.
add all static content to cache on app update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const staticResourcesAndPath = [ | |
'/skeleton', | |
'js/main.js', | |
'css/main.css', | |
'imgs/icon.png', | |
'https://fonts.gstatic.com/s/roboto/v15/2UX7WLTfW3W8TclTUvlFyQ.woff', | |
'https://fonts.gstatic.com/s/roboto/v15/d-6IYplOFocCacKzxwXSOD8E0i7KZn-EPnyo3HZu7kw.woff' | |
]; | |
self.addEventListener('install', function (event) { | |
event.waitUntil( | |
caches.open('myStaticCacheName').then(function (cache) { | |
return cache.addAll(staticResourcesAndPath); | |
}) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment