Cancelling method calls when the same method is called multiple time

后端 未结 3 727
梦如初夏
梦如初夏 2021-01-13 06:05

I think there\'s probably a name for what I\'m describing here, but I don\'t know it. So my first question would be to know the name of this technique.

Here\'s an ex

3条回答
  •  庸人自扰
    2021-01-13 06:47

    Given the other answers, and after some searching, it seems there's indeed no library that does what I wanted.

    I created one and put it on GitHub. Future readers of this question may find it interesting.

    https://github.com/ThomasGirard/JDebounce

    I don't think it's very good yet but at least it works and can be used declaratively:

    @Debounce(delayMilliseconds = 100)
    public void debouncedMethod(int callID, DebounceTest callback) { }
    

提交回复
热议问题