Created
May 10, 2017 17:09
-
-
Save ukmadlz/df22c048f5b19786c4a82763f1149f11 to your computer and use it in GitHub Desktop.
Cloudinary PWA React Blog
This file contains hidden or 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
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