Last active
January 28, 2022 13:24
-
-
Save steph-crown/04c157fb20392589dfbc0c145763afcb to your computer and use it in GitHub Desktop.
A service worker file
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
// Listens to an install event | |
self.addEventListener("install", (event) => { | |
event.waitUntil( | |
// We try to open a cache named "assets". | |
// If it does not exist, a new one will be created and named "assets" | |
caches.open("assets").then((cache) => { | |
// Add an array of path to files you want to add to cache | |
return cache.addAll([ | |
"./", | |
"./css/index.css", | |
"./assets/logo192.png", | |
"./assets/logo512.png", | |
]); | |
}) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment