gpt4 book ai didi

rxjs - RxJS 中通知的用例是什么?

转载 作者:数据小太阳 更新时间:2023-10-29 06:15:19 26 4
gpt4 key购买 nike

我对基本的 RxJS 概念有点熟悉,比如 Observables、Observers 和 Subjects,但是 RxJS Notifications概念对我来说是全新的。

它有什么用?我应该什么时候使用它?

最佳答案

您引用的文档提到:

This class is particularly useful for operators that manage notifications, like materialize, dematerialize, observeOn, and others. Besides wrapping the actual delivered value, it also annotates it with metadata of, for instance, what type of push message it is (next, error, or complete).

所以问题原来是关于 materialize 等的用例。

基本上,您使用 materialize 来获取有关数据流的元信息,而不会引起相关的副作用(例如,流中发生的错误传播,完成的流可能导致完成其他流等)。 dematerialize 允许恢复副作用。

以下是以前 SO 问题的用例:

关于rxjs - RxJS 中通知的用例是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37649462/

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