首页 > 解决方案 > 当我们使用 RxJava 限制视图点击时,限制方法调用

问题描述

有没有办法限制方法调用,即只在某个窗口持续时间内接受第一个事件。我见过 RxBinding 的例子,比如

RxView.clicks(mButton)
            .throttleFirst(300, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
            .subscribe(...);

我怎样才能对方法进行上述操作?

标签: rx-javarx-java2rx-binding

解决方案


在 RxJava2 中有这样的运算符 - http://reactivex.io/documentation/operators/sample.html


推荐阅读