only initialize service workers if they are available

This commit is contained in:
Andreas Nedbal 2023-10-17 20:09:12 +02:00 committed by Andreas Nedbal
parent 87813d3005
commit 3aa18ef7c7
1 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,5 @@
export default function (): void {
navigator.serviceWorker.register("/service_worker.js", { scope: "/" });
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register("/service_worker.js", { scope: "/" });
}
}