How to throttle event stream using RX?

前端 未结 8 714
终归单人心
终归单人心 2020-11-27 04:04

I want to effectively throttle an event stream, so that my delegate is called when the first event is received but then not for 1 second if subsequent events are received. A

8条回答
  •  有刺的猬
    2020-11-27 04:26

    What you are searching for is the CombineLatest.

    public static IObservable CombineLatest(
        IObservable leftSource,
        IObservable rightSource,
        Func selector
    )
    

    that merges 2 obeservables, and returning all values, when the selector (time) has a value.

    edit: john is right, that is maybe not the preferred solution

提交回复
热议问题