Created
February 10, 2022 02:15
-
-
Save LiorB-D/b2a087895a3f12e729844dff065a3977 to your computer and use it in GitHub Desktop.
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 staticCacheName = "hello-pwa"; | |
| self.addEventListener("install", function (e) { | |
| e.waitUntil( | |
| caches.open(staticCacheName).then(function (cache) { | |
| return cache.addAll(["/"]); | |
| }) | |
| ); | |
| }); | |
| self.addEventListener("fetch", function (event) { | |
| console.log(event.request.url); | |
| event.respondWith( | |
| caches.match(event.request).then(function (response) { | |
| return response || fetch(event.request); | |
| }) | |
| ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment