Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
HarmlessHarm committed Nov 2, 2024
1 parent 026fed3 commit 6af6387
Showing 1 changed file with 50 additions and 51 deletions.
101 changes: 50 additions & 51 deletions src-pwa/register-service-worker.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,65 @@
import { register } from 'register-service-worker';
import { register } from "register-service-worker";

// The ready(), registered(), cached(), updatefound() and updated()
// events passes a ServiceWorkerRegistration instance in their arguments.
// ServiceWorkerRegistration: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration

register(process.env.SERVICE_WORKER_FILE, {
// The registrationOptions object will be passed as the second argument
// to ServiceWorkerContainer.register()
// https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register#Parameter
// The registrationOptions object will be passed as the second argument
// to ServiceWorkerContainer.register()
// https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register#Parameter

// registrationOptions: { scope: './' },
// registrationOptions: { scope: './' },

ready (/* registration */) {
// console.log('Service worker is active.')
},
ready(/* registration */) {
// console.log('Service worker is active.')
},

registered (/* registration */) {
// console.log('Service worker has been registered.')
},
registered(/* registration */) {
// console.log('Service worker has been registered.')
},

cached (/* registration */) {
// console.log('Content has been cached for offline use.')
},
cached(/* registration */) {
// console.log('Content has been cached for offline use.')
},

updatefound (registration) {
try {
registration.update()
} catch (err) {
console.err('SW update failed:', err)
}
}
updatefound(registration) {
try {
registration.update();
} catch (err) {
console.err("SW update failed:", err);
}
},

updated(registration) {
// Cleares old cash so new content is downloaded
caches.keys().then(function (names) {
for (let name of names) {
console.log("SW Updated. Delete cache", name);
caches.delete(name);
}
});

updated (registration) {
// Cleares old cash so new content is downloaded
caches.keys().then(function(names) {
for (let name of names) {
console.log("SW Updated. Delete cache", name)
caches.delete(name);
}
});
// Nofitify the user and let them download the new content
// Notify.create({
// message: "New content available.",
// type: "info",
// icon: "fas fa-arrow-alt-to-bottom",
// color: "neutral-7",
// iconSize: "15px",
// position: "top",
// timeout: 0,
// actions: [
// { label: 'Fetch', color: 'white', noCaps: true, size: "md", handler: () => { registration.waiting.postMessage({ type: "SKIP_WAITING" }); } },
// ]
// });
},

// Nofitify the user and let them download the new content
// Notify.create({
// message: "New content available.",
// type: "info",
// icon: "fas fa-arrow-alt-to-bottom",
// color: "neutral-7",
// iconSize: "15px",
// position: "top",
// timeout: 0,
// actions: [
// { label: 'Fetch', color: 'white', noCaps: true, size: "md", handler: () => { registration.waiting.postMessage({ type: "SKIP_WAITING" }); } },
// ]
// });
},
offline() {
// console.log('No internet connection found. App is running in offline mode.')
},

offline () {
// console.log('No internet connection found. App is running in offline mode.')
},

error (/* err */) {
// console.error('Error during service worker registration:', err)
}
});
error(/* err */) {
// console.error('Error during service worker registration:', err)
},
});

0 comments on commit 6af6387

Please sign in to comment.