Refactored other browser observables, removed memleaks

This commit is contained in:
squidfunk 2020-08-22 18:03:47 +02:00
parent 8a6b89ffe1
commit c7d770bbe3
3 changed files with 4 additions and 5 deletions

View File

@ -51,6 +51,6 @@ export function watchLocationBase(
.toString() .toString()
.replace(/\/$/, "") .replace(/\/$/, "")
), ),
shareReplay(1) shareReplay({ bufferSize: 1, refCount: true })
) )
} }

View File

@ -41,6 +41,6 @@ export function watchMedia(query: string): Observable<boolean> {
) )
.pipe( .pipe(
startWith(media.matches), startWith(media.matches),
shareReplay(1) shareReplay({ bufferSize: 1, refCount: true })
) )
} }

View File

@ -78,7 +78,7 @@ export function watchViewport(): Observable<Viewport> {
]) ])
.pipe( .pipe(
map(([offset, size]) => ({ offset, size })), map(([offset, size]) => ({ offset, size })),
shareReplay(1) shareReplay({ bufferSize: 1, refCount: true })
) )
} }
@ -116,7 +116,6 @@ export function watchViewportAt(
y: offset.y - y + height y: offset.y - y + height
}, },
size size
})), }))
shareReplay(1)
) )
} }