2021-07-29 16:42:31 +02:00
|
|
|
export class _ServiceWorker {
|
|
|
|
constructor() {
|
|
|
|
if ("serviceWorker" in navigator) {
|
|
|
|
this.init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
init() {
|
2021-08-04 13:33:58 +02:00
|
|
|
navigator.serviceWorker
|
|
|
|
.register("/service-worker.js")
|
|
|
|
.then((serviceWorker) => {
|
|
|
|
console.info("Service Worker registered: ", serviceWorker);
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error("Error registering the Service Worker: ", error);
|
|
|
|
});
|
2021-07-29 16:42:31 +02:00
|
|
|
}
|
|
|
|
}
|