Set a service worker scope

This commit is contained in:
Marks Polakovs 2020-05-09 16:57:30 +02:00
parent 66abc19412
commit 80b2f67975

View file

@ -67,7 +67,9 @@ export function register(config?: Config) {
function registerValidSW(swUrl: string, config?: Config) { function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl, {
scope: window.location.pathname
})
.then((registration) => { .then((registration) => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;