-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30e0c91
commit b7eeece
Showing
6 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { register } from "register-service-worker"; | ||
|
||
register("/serviceWorker.js", { | ||
registrationOptions: { scope: "./" }, | ||
ready(registration) { | ||
console.log("Service worker is active."); | ||
}, | ||
registered(registration) { | ||
console.log("Service worker has been registered."); | ||
}, | ||
cached(registration) { | ||
console.log("Content has been cached for offline use."); | ||
}, | ||
updatefound(registration) { | ||
console.log("New content is downloading."); | ||
}, | ||
updated(registration) { | ||
console.log("New content is available; please refresh."); | ||
}, | ||
offline() { | ||
console.log("No internet connection found. App is running in offline mode."); | ||
}, | ||
error(error) { | ||
console.error("Error during service worker registration:", error); | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable no-undef, no-restricted-globals */ | ||
|
||
// This is the code piece that GenerateSW mode can't provide for us. | ||
// This code listens for the user's confirmation to update the app. | ||
self.addEventListener('message', event => { | ||
console.log(event); | ||
if (event.data && event.data.type === 'SKIP_WAITING') { | ||
self.skipWaiting(); | ||
} | ||
}); | ||
|
||
console.log("Loading serviceWorker.js") | ||
|
||
//workbox.clientsClaim(); | ||
|
||
// The precaching code provided by Workbox. | ||
self.__precacheManifest = [].concat(self.__precacheManifest || []); | ||
workbox.precaching.suppressWarnings(); | ||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); |
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