Immediate debounce in Rx

后端 未结 4 1667
南笙
南笙 2021-02-02 11:59

I am looking an operator to debounce a series of event, let us say user\'s click. The input and output should be like this:

interval :      ->            


        
4条回答
  •  感情败类
    2021-02-02 12:31

    Because debounce() is inherently asynchronous, you need to bring the result back to the current thread explicitly.

    seriesOfUnfortunateEvents
      .debounce( 14, TimeUnit.MILLISECONDS )
      .observeOn( Schedulers.immediate() )
      .subscribe( v -> yourStuff() );
    

提交回复
热议问题