Package com.vaadin.client.flow.binding
Class Debouncer
- java.lang.Object
-
- com.vaadin.client.flow.binding.Debouncer
-
public class Debouncer extends Object
Manages debouncing of events. UsegetOrCreate(Node, String, double)to either create a new instance or get an existing instance that currently tracks a sequence of similar events.- Since:
- 1.0
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<Consumer<String>>flushAll()Flushes all pending changes.static DebouncergetOrCreate(elemental.dom.Node element, String identifier, double debounce)Gets an existing debouncer or creates a new one associated with the given DOM node, identifier and debounce timeout.booleantrigger(JsSet<String> phases, Consumer<String> command)Informs this debouncer that an event has occurred.
-
-
-
Method Detail
-
trigger
public boolean trigger(JsSet<String> phases, Consumer<String> command)
Informs this debouncer that an event has occurred.- Parameters:
phases- a set of strings identifying the phases for which the triggered event should be considered.command- a consumer that will may be asynchronously invoked with a phase code if an associated phase is triggered- Returns:
trueif the event should be processed as-is without delaying
-
getOrCreate
public static Debouncer getOrCreate(elemental.dom.Node element, String identifier, double debounce)
Gets an existing debouncer or creates a new one associated with the given DOM node, identifier and debounce timeout.- Parameters:
element- the DOM node to which this debouncer is boundidentifier- a unique identifier string in the scope of the provided elementdebounce- the debounce timeout- Returns:
- a debouncer instance
-
-