Package com.vaadin.flow.dom
Enum Class DebouncePhase
- All Implemented Interfaces:
Serializable
,Comparable<DebouncePhase>
,Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionDebounce phase for events that are periodically sent to the server while events are being fired in rapid succession.Debounce phase that happens immediately when the event is first triggered.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. -
Method Summary
Modifier and TypeMethodDescriptionstatic DebouncePhase
forIdentifier
(String identifier) Gets the phase that corresponds to the given identifier character.Gets the string that is used to identify this phase.static DebouncePhase
Returns the enum constant of this class with the specified name.static DebouncePhase[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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 withLEADING
so that the first event is sent immediately. Can also for special cases be combined withTRAILING
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
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
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
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 nameNullPointerException
- if the argument is null
-
getIdentifier
Gets the string that is used to identify this phase.- Returns:
- the identifier string
- See Also:
-
forIdentifier
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:
-