Set a service worker scope
This commit is contained in:
parent
66abc19412
commit
80b2f67975
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue