Class Debounce<T>

Type Parameters:
T - The type of the user input.

public class Debounce<T> extends Object
Debounces user input. Useful whenever there are frequent user input changes (e.g. slider input), to reduce emissions of value changes.
  • Constructor Details

    • Debounce

      public Debounce(int debounceTimeInMs, Debounce.DebounceEmissionHandler<T> handler)
      debounceTimeInMs - The time to wait until emission.
      handler - Function which handles the user input.
  • Method Details

    • next

      public void next(T t)
      Queue a value for emission.
      t - The value to emit, if no other value replaces it within the debounce time.