Enum Class DebouncePhase

java.lang.Object
java.lang.Enum<DebouncePhase>
com.vaadin.flow.dom.DebouncePhase
All Implemented Interfaces:
Serializable, Comparable<DebouncePhase>, Constable

public enum DebouncePhase extends Enum<DebouncePhase>
Defines phases for an event that is debounced. For most cases, high level methods such as DomListenerRegistration.debounce(int) or DomListenerRegistration.throttle(int) should be used instead.
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Enum Constant Details

    • LEADING

      public static final DebouncePhase LEADING
      Debounce phase that happens immediately when the event is first triggered. Another leading event will not be sent to the server until the debounce timeout period has passed without any new events being fired. This is useful for cases such as button click where double submitting should be avoided.
    • INTERMEDIATE

      public static final DebouncePhase INTERMEDIATE
      Debounce phase for events that are periodically sent to the server while events are being fired in rapid succession. This is useful for cases such as text input when you don't want to receive an event for each individual keystroke, but still want periodic updates. This is sometimes useful in combination with LEADING so that the first event is sent immediately. Can also for special cases be combined with TRAILING to get a separate event when the input has stopped, but this combination should be handled with care: the exact same event is sent twice in the end. First with INTERMEDIATE phase and then with TRAILING.
    • TRAILING

      public static final DebouncePhase TRAILING
      Trailing phase that is sent to the server once there have been at least one timeout period since the last event of the same type. This is useful for cases such as text input when you are only want to react to the text when the user pauses typing.
  • Method Details

    • values

      public static DebouncePhase[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DebouncePhase valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getIdentifier

      public String getIdentifier()
      Gets the string that is used to identify this phase.
      Returns:
      the identifier string
      See Also:
    • forIdentifier

      public static DebouncePhase forIdentifier(String identifier)
      Gets the phase that corresponds to the given identifier character.
      Parameters:
      identifier - the identifier character to look for
      Returns:
      the debounce phase corresponding to the provided identifier character
      Throws:
      IllegalArgumentException - if there is no corresponding character
      See Also: