How can I use Reactive Extensions to throttle Events using a max window size?

后端 未结 2 1097
暖寄归人
暖寄归人 2021-02-08 15:30

Scenario:

I am building a UI application that gets notifcations from a backend service every few milliseconds. Once I get a new notification i want to u

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 15:44

    Don't use Observable.Throttle, use Observable.Sample like this, where the TimeSpan gives the desired minimum interval between updates:

    source.Sample(TimeSpan.FromMilliseconds(50))
    

提交回复
热议问题