Skip to content

Instantly share code, notes, and snippets.

@ukmadlz
Created May 10, 2017 17:09
Show Gist options
  • Save ukmadlz/df22c048f5b19786c4a82763f1149f11 to your computer and use it in GitHub Desktop.
Save ukmadlz/df22c048f5b19786c4a82763f1149f11 to your computer and use it in GitHub Desktop.
Cloudinary PWA React Blog
var cacheNameStatic = 'cloudinary-pwa-react-v1';
var currentCacheNames = [ cacheNameStatic ];
var cachedUrls = [
// 3rd party CDN
'https://unpkg.com/babel-core@5.8.38/browser.min.js',
'https://unpkg.com/lodash@4.17.4/lodash.js',
'https://unpkg.com/react@15.3.1/dist/react.min.js',
'https://unpkg.com/react-dom@15.3.1/dist/react-dom.min.js',
'https://unpkg.com/react-router-dom/umd/react-router-dom.min.js',
'https://unpkg.com/cloudinary-core@2.3.0/cloudinary-core.js',
'https://unpkg.com/cloudinary-react@1.0.3/dist/cloudinary-react.js',
'https://unpkg.com/axios/dist/axios.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/css/materialize.min.css',
// Local assets
'/style.css',
// Fake API
'/images.json'
];
// A new ServiceWorker has been registered
self.addEventListener("install", function (event) {
event.waitUntil(
caches.delete(cacheNameStatic).then(function() {
return caches.open(cacheNameStatic);
}).then(function (cache) {
return cache.addAll(cachedUrls);
}).catch(function(e) {
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment