mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
18 lines
442 B
JavaScript
18 lines
442 B
JavaScript
|
export function cleanupServiceWorker() {
|
||
|
try {
|
||
|
navigator.serviceWorker
|
||
|
.getRegistrations()
|
||
|
.catch(() => {
|
||
|
// fail silently if permission not given (e.g. SecurityError)
|
||
|
return []
|
||
|
})
|
||
|
.then(registrations => {
|
||
|
registrations.forEach(worker => {
|
||
|
worker.unregister()
|
||
|
})
|
||
|
})
|
||
|
} catch (e) {
|
||
|
// fail silently if service worker are not available (on the navigator)
|
||
|
}
|
||
|
}
|