English 中文(简体)
热能和冷能是什么?
原标题:What are the Hot and Cold observables?

I watched the video and I know the general principles - hot happens even when nobody is subscribed, cold happens "on demand". Also, Publish() converts cold to hot and Defer() converts hot to cold.

但我仍然认为我没有细节。 以下是我回答的一些问题:

  • Can you give a comprehensive definition for these terms?
  • Does it ever make sense to call Publish on a hot observable or Defer on a cold?
  • What are the aspects of Hot/Cold conversions - do you lose messages, for example?
  • Are there differences between hot and cold definitions for IObservable and IEnumerable?
  • What are the general principles you should take into account when programming for cold or hot?
  • Any other tips on hot/cold observables?
最佳回答

我希望这一帮助。

Can you give a comprehensive definition for these terms?

See my blog post at: https://leecampbell.com 201008/19/rx-part-7-hot-and-cold-observables

Does it ever make sense to call Publish on a hot observable or Defer on a cold?

不是我可以想象的。

What are the aspects of Hot/Cold conversions - do you lose messages, for example?

在可观测为热点时可以“披露”信息,因为不论用户如何,都会出现“偶发”。

Are there differences between hot and cold definitions for IObservable and IEnumerable?

我完全理解这个问题。 我希望这种类比会有所助益。 我将比较一个热能与一个Eagerly评估的Echable。 也就是说,对清单或阿雷娜都进行了评价,即使没有人对清单进行处理,也已经有人居住。 从档案或数据库中获取价值的收益说明,可用Yeld关键词加以仔细评估。 zy虽然是好的,但如果第二位查点人接手,则会因违约而重新评价。 与可观测站相比,“热能”可能是一次活动(Button点击)或气温加热;不管订阅情况如何,这些事件都会发生,如果对同一观测站多次订阅,也会分享。 可观察。 间隔期是冷战时期的一个良好范例。 只有在签署时,才会开始产生价值。 如果按规定多次订阅,顺序将重新评价,“签字”则在适当时间发生(取决于订阅时间)。

在为寒冷或热制定方案时,应当考虑到哪些一般原则?

参见第1点。 我也建议你考虑与RefCount共同使用普布尔什。 这使你能够拥有拉齐冷的观测台,但能够分享热观测站的活动。

Any other tips on hot/cold observables?

你们的手.,与他们一起玩.。 如果你阅读了30多分钟,那么与他们一起使用的时间远比阅读更有成效:

问题回答

http://www.manning.com/books/angular-development-with-typescript-second-edition” rel=“noreferer”“Angular Development with打字体,第二版:

<>Hot 和 cold>

There are two types of observables: hot and cold. The main difference is that a cold observable creates a data producer for each subscriber, whereas a hot observable creates a data producer first, and each subscriber gets the data from one producer, starting from the moment of subscription.

Let’s compare watching a movie on Netflix to going into a movie theater. Think of yourself as an observer. Anyone who decides to watch Mission: Impossible on Netflix will get the entire movie, regardless of when they hit the play button. Netflix creates a new producer to stream a movie just for you. This is a cold observable.

If you go to a movie theater and the showtime is 4 p.m., the producer is created at 4 p.m., and the streaming begins. If some people (subscribers) are late to the show, they miss the beginning of the movie and can only watch it starting from the moment of arrival. This is a hot observable.

A cold observable starts producing data when some code invokes a subscribe() function on it. For example, your app may declare an observable providing a URL on the server to get certain products. The request will be made only when you subscribe to it. If another script makes the same request to the server, it’ll get the same set of data.

A hot observable produces data even if no subscribers are interested in the data. For example, an accelerometer in your smartphone produces data about the position of your device, even if no app subscribes to this data. A server can produce the latest stock prices even if no user is interested in this stock.

热观测站是那些在不赞成可观测到的情形下推动活动的人。 就像变迁,或时间尺度或类似的东西。 冷静的观测站只是那些在你签字时才开始推展的,如果你再次签字,它们就开始走下去。

我不想作全面回答,而是想以最简单的形式总结我自这个问题发生以来所学到的内容。

<>可观测准确对应活动。 在活动中,即使没有用户聆听,价值观通常也会被带入手。 所有用户都得到同样的价值。 由于采用了“喷口”模式,热观测站比寒冷。

www.un.org/Depts/DGACM/index_spanish.htm 冷可观察的也是一种事件,但是,如果存在扭曲性的情况,即冷静的观察活动不是共同的,则是一种财产,每当有人订阅时,就由工厂生产。 此外,订阅也开始产生价值。 由于上述原因,多个用户是孤立的,每个用户都有自己的一套价值。

最常见的RX开端错误是,在功能(f. 累积总数)内使用某些国家变量,形成一种冷静可观察的(好坏,认为它们正在形成一种冷静可观察的)办法,而不是将其归纳为“Defer()”声明。 因此,多个用户分享这些变量,并在这些变量之间产生副作用。





相关问题
Split an IObservable and then combine after processing?

After experimenting with IObservables, I ve decided to test them for the processing of incoming messages over a message bus. Essentially I get an IObservable<Request> and the Request contains ...

Silverlight Toolkit DragDrop on WPF

Do Microsoft actually provide a build of Rx / Silverlight Toolkit DragDrop that "just works" on WPF? From what I can tell the Rx DragDrop stuff is only available in the SL Toolkit (not WPF). The SL ...

How can I update UI when Observable.Context is not available?

I have a WinFrom App, use synchronous method to download string from a url, and use Rx ToAsync Method to make it asynchronous and get the observable result, and when the result comes I show it on the ...

Reactive Extensions (Rx) + MVVM =?

One of the main examples being used to explain the power of Reactive Extensions (Rx) is combining existing mouse events into a new event representing deltas during mouse drag: var mouseMoves = from ...

热门标签