-
-
Save erictherobot/5778631a1fcc72d45d5c18f5359a0809 to your computer and use it in GitHub Desktop.
PWA Service Worker Register - DENO FRESH
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
// This is the service worker with the Advanced caching | |
// Add this below content to your HTML page inside a <script type="module"></script> tag, or add the js file to your page at the very top to register service worker | |
// If you get an error about not being able to import, double check that you have type="module" on your <script /> tag | |
/* | |
This code uses the pwa-update web component https://github.com/pwa-builder/pwa-update to register your service worker, | |
tell the user when there is an update available and let the user know when your PWA is ready to use offline. | |
*/ | |
import "https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate"; | |
const el = document.createElement("pwa-update"); | |
document.body.appendChild(el); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment