don't try to access serviceworker if it doesn't exist
This commit is contained in:
parent
1a577cfcfc
commit
ec367ad761
1 changed files with 1 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ function isPushSupported () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrCreateServiceWorker () {
|
function getOrCreateServiceWorker () {
|
||||||
|
if (!isSWSupported()) return
|
||||||
const swType = process.env.HAS_MODULE_SERVICE_WORKER ? 'module' : 'classic'
|
const swType = process.env.HAS_MODULE_SERVICE_WORKER ? 'module' : 'classic'
|
||||||
return navigator.serviceWorker.register('/sw-pleroma.js', { type: swType })
|
return navigator.serviceWorker.register('/sw-pleroma.js', { type: swType })
|
||||||
.catch((err) => console.error('Unable to get or create a service worker.', err))
|
.catch((err) => console.error('Unable to get or create a service worker.', err))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue