Class Debounce<T>

java.lang.Object
com.levigo.jadice.web.client.util.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)
      Parameters:
      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.
      Parameters:
      t - The value to emit, if no other value replaces it within the debounce time.