gpt4 book ai didi

javascript - 如何阅读 RxJs mergeMap 弹珠图

转载 作者:行者123 更新时间:2023-12-03 06:59:30 26 4
gpt4 key购买 nike

在此 mergeMap 的大理石图中, 你怎么读这个表达式?

// Kind of, looks like an em-dash near the end
mergeMap(i => 10*i--10*i--10*i--|)
enter image description here

最佳答案

mergeMap map i到由字符串 10*i--10*i--10*i-| 表示的 observable .该字符串包含 marble syntax代表在虚拟时间发生的事件。
文档中使用的主要字符是:

  • - frame: 1 "frame" of virtual time passing
  • [a-z0-9] any alphanumeric character: Represents a value being emitted by the producer signaling next().
  • | complete: The successful completion of an observable. This is the observable producer signaling complete().
  • # error: An error terminating the observable. This is the observable producer signaling error().

所以 10--10--10-|将是图片中第二个 observable 的表达式。
例如
const tens$ = timer(0, 4).pipe(take(3), mapTo(10))
10*i--10*i--10*i-|是当您将 10--10--10-| 发出的每个值相乘时得到的 observable 的表达式与 i .
例如
of(1,3,5).pipe(
mergeMap(i => tens$.pipe(map(v => v*i)))
)

关于javascript - 如何阅读 RxJs mergeMap 弹珠图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64288479/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com