aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/service-worker.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-03 19:38:05 +0800
committerGitHub <noreply@github.com>2021-01-03 19:38:05 +0800
commit418d631528fdb581a384068719e9af5dbaa66740 (patch)
tree42e2c0396a16cb5fbaaae665a238a8a031bef7f0 /FrontEnd/src/app/service-worker.tsx
parent4b3ae3edd9e8aceac5ff26ef137d2a8d686fe305 (diff)
parent8af803cb0da57af1355ad28cd056cb5dcf6d6915 (diff)
downloadtimeline-418d631528fdb581a384068719e9af5dbaa66740.tar.gz
timeline-418d631528fdb581a384068719e9af5dbaa66740.tar.bz2
timeline-418d631528fdb581a384068719e9af5dbaa66740.zip
Merge pull request #197 from crupest/front-dev
Front: Highlight and bookmark timeline and new home page.
Diffstat (limited to 'FrontEnd/src/app/service-worker.tsx')
-rw-r--r--FrontEnd/src/app/service-worker.tsx11
1 files changed, 4 insertions, 7 deletions
diff --git a/FrontEnd/src/app/service-worker.tsx b/FrontEnd/src/app/service-worker.tsx
index 3be54bc1..2dc7fb6e 100644
--- a/FrontEnd/src/app/service-worker.tsx
+++ b/FrontEnd/src/app/service-worker.tsx
@@ -70,7 +70,9 @@ if ("serviceWorker" in navigator) {
}
});
- const showSkipWaitingPrompt = (): void => {
+ // Add an event listener to detect when the registered
+ // service worker has installed but is waiting to activate.
+ wb.addEventListener("waiting", (): void => {
const upgrade = (): void => {
isThisTriggerUpgrade = true;
if (registration && registration.waiting) {
@@ -99,12 +101,7 @@ if ("serviceWorker" in navigator) {
dismissTime: "never",
type: "success",
});
- };
-
- // Add an event listener to detect when the registered
- // service worker has installed but is waiting to activate.
- wb.addEventListener("waiting", showSkipWaitingPrompt);
- wb.addEventListener("externalwaiting", showSkipWaitingPrompt);
+ });
void wb.register().then((reg) => {
registration = reg;