Created
March 21, 2018 18:07
-
-
Save jacky810124/09ece71b945716278afa3e5f2ddabc4c to your computer and use it in GitHub Desktop.
PWA Day04 cache
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
const APP_ASSETS_CACHE_NAME = `app-assets-cache-v0.0.1` | |
self.addEventListener('install', event => { | |
console.log('[Service Worker] - install event') | |
event.waitUntil( | |
self | |
.caches | |
.open(APP_ASSETS_CACHE_NAME) | |
.then(cache => { | |
return cache.addAll([ | |
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css', | |
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js', | |
'https://unpkg.com/[email protected]/dist/vue-router.js', | |
'https://code.jquery.com/jquery-3.2.1.slim.min.js', | |
'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', | |
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', | |
'/app.js', | |
'/manifest.json', | |
'/', | |
]) | |
}) | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment