com.vaadin.flow.dom.
Enum DebouncePhase
- java.lang.Object
-
- java.lang.Enum<DebouncePhase>
-
- com.vaadin.flow.dom.DebouncePhase
-
All Implemented Interfaces:
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)
orDomListenerRegistration.throttle(int)
should be used instead.Since:
1.0
Author:
Vaadin Ltd
See Also:
DomListenerRegistration.debounce(int, DebouncePhase, DebouncePhase...)
,DomEvent.getPhase()
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description INTERMEDIATE
Debounce phase for events that are periodically sent to the server while events are being fired in rapid succession.
LEADING
Debounce phase that happens immediately when the event is first triggered.
TRAILING
Debounce phase that is sent to the server once there have been at least one debounce timeout period since the last event of the same type.
-
Method Summary
All Methods Modifier and Type Method and Description static DebouncePhase
forIdentifier(String identifier)
Gets the phase that corresponds to the given identifier character.
String
getIdentifier()
Gets the string that is used to identify this phase.
static DebouncePhase
valueOf(String name)
Returns the enum constant of this type with the specified name.
static DebouncePhase[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 be combined withTRAILING
to get a separate event when the input has stopped.
-
TRAILING
public static final DebouncePhase TRAILING
Debounce phase that is sent to the server once there have been at least one debounce 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 Detail
-
values
public static DebouncePhase[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DebouncePhase c : DebouncePhase.values()) System.out.println(c);
Returns:
an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DebouncePhase valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- 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 forReturns:
the debounce phase corresponding to the provided identifier character
Throws:
IllegalArgumentException
- if there is no corresponding characterSee Also:
-
-