Shouldn't there be a "mergeTap"? #7320
striderhobbit
started this conversation in
Ideas / Feature request
Replies: 1 comment 1 reply
-
I think the Example: interval(3000)
.pipe(
delayWhen(
() =>
new Promise<void>((resolve) =>
setTimeout(() => (console.log('inner'), resolve()), 2000)
)
)
)
.subscribe(console.log); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Imagine a series of operator functions, like
map
,mergeMap
etc. Usingtap
along the series works fine for synchronous tasks, but what if I want to perform an asynchronous action (before moving on to the next operator function), without modifying the piped value.If you do
console output will be
inner
afterouter
. Usingawait
on the inner promise won't make any difference.Of course, this would work:
but I don't like touching
value
that I don't want to modify anyway.So what would be quite handy is some kind of
mergeTap
operator, which would be likemergeMap
but return the input value as is. I could then writeBeta Was this translation helpful? Give feedback.
All reactions