Ensure event listeners are passive

This commit is contained in:
squidfunk
2020-03-17 16:43:49 +01:00
parent 0982cbe2e1
commit 153aaabbaa
10 changed files with 13 additions and 13 deletions

View File

@@ -74,8 +74,8 @@ export function setViewportOffset(
*/
export function watchViewportOffset(): Observable<ViewportOffset> {
return merge(
fromEvent<UIEvent>(window, "scroll"),
fromEvent<UIEvent>(window, "resize")
fromEvent<UIEvent>(window, "scroll", { passive: true }),
fromEvent<UIEvent>(window, "resize", { passive: true })
)
.pipe(
map(getViewportOffset),

View File

@@ -83,7 +83,7 @@ export function patchScrollfix(
iif(isAppleDevice, els$, NEVER)
.pipe(
switchMap(els => merge(...els.map(el => (
fromEvent(el, "touchstart")
fromEvent(el, "touchstart", { passive: true })
.pipe(
mapTo(el)
)