在RXJS中可观察到的回路?
这是一个令人费解的示例,但是我想知道如何在RXJS中进行以下操作:在管道中的某个部分之后,将值馈回管道的早期部分,因此它将再次处理。
of(1, 2, 3, 4, 5).pipe(
map(x => x + 1),
map(x => x + 1),
filter(x => x % 2),
// refeed after the first map but before the second
)
This is a bit of a convoluted example, but I was wondering how to do the following in RxJs: After a certain part in the pipeline, feed the value back into an earlier part of the pipeline, so it will get processed again.
of(1, 2, 3, 4, 5).pipe(
map(x => x + 1),
map(x => x + 1),
filter(x => x % 2),
// refeed after the first map but before the second
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是您如何使用展开来执行此操作的一个示例:
您可能会写递归功能以执行此操作:
Here's an example of how you might use expand to do this:
Here's how you might write a recursive function to do this: