public class Debouncer
extends java.lang.Object
implements java.lang.Runnable
Constructor and Description |
---|
Debouncer(java.lang.Runnable target,
java.time.Duration debounceDelay)
Creates a new debouncer.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the debouncer.
|
java.time.Duration |
getDebounceDelay()
Gets the maximum amount of time after a method has been called to wait before running it.
|
void |
run() |
public Debouncer(java.lang.Runnable target, java.time.Duration debounceDelay)
target
- the target function that should be debounceddebounceDelay
- the maximum time delta between calls that should be allowedpublic void run()
run
in interface java.lang.Runnable
public java.time.Duration getDebounceDelay()
public void cancel()
run()
is called later.