Improved semantics when returning from switchMap

This commit is contained in:
squidfunk
2022-03-08 10:31:38 +01:00
parent eea6d1eec4
commit 1d1cf476c8
11 changed files with 18 additions and 20 deletions

View File

@@ -260,7 +260,7 @@ export function setupInstantLoading(
.pipe(
skip(1),
map(() => getComponentElement("container")),
switchMap(el => of(...getElements("script", el))),
switchMap(el => getElements("script", el)),
concatMap(el => {
const script = h("script")
if (el.src) {

View File

@@ -25,7 +25,6 @@ import {
fromEvent,
mapTo,
mergeMap,
of,
switchMap,
takeWhile,
tap,
@@ -63,9 +62,9 @@ export function patchIndeterminate(
): void {
document$
.pipe(
switchMap(() => of(...getElements<HTMLInputElement>(
switchMap(() => getElements<HTMLInputElement>(
"[data-md-state=indeterminate]"
))),
)),
tap(el => {
el.indeterminate = true
el.checked = false

View File

@@ -26,7 +26,6 @@ import {
fromEvent,
mapTo,
mergeMap,
of,
switchMap,
tap
} from "rxjs"
@@ -77,7 +76,7 @@ export function patchScrollfix(
): void {
document$
.pipe(
switchMap(() => of(...getElements("[data-md-scrollfix]"))),
switchMap(() => getElements("[data-md-scrollfix]")),
tap(el => el.removeAttribute("data-md-scrollfix")),
filter(isAppleDevice),
mergeMap(el => fromEvent(el, "touchstart")