Class Debouncer<T>
java.lang.Object
com.inductiveautomation.ignition.designer.mvvm.Debouncer<T>
This class is used to debounce data updates. If you need to know when the debouncer enters the active state, you can
provide a callback to be called when the first data update is received after the
waitTime
has passed.-
Constructor Summary
ConstructorsConstructorDescriptionUse this variant of the constructor if you don't need to do anything when the debouncer enters the active state.This in the main constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
notifyConsumer
(T value) protected void
scheduleTask
(T value, long executionDelay) void
-
Constructor Details
-
Debouncer
Use this variant of the constructor if you don't need to do anything when the debouncer enters the active state.- Parameters:
waitTime
- The time to wait before calling theonDataCallback
after the last data update.onDataCallback
- The callback to call when thewaitTime
has passed without any new data updates.
-
Debouncer
This in the main constructor. The inactive state happens when there has been no new data updates to this class for the duration of thewaitTime
. The active state happens when this class receives new data updates.
Upon entering the active state, theonStartCallback
is called if one is provided. It will remain in the active state until thewaitTime
has passed without any new data updates. When that happens theonDataCallback
is called.- Parameters:
waitTime
- The time to wait before calling theonDataCallback
after the last data update.onDataCallback
- The callback to call when thewaitTime
has passed without any new data updates.onStartCallback
- The callback to call when the first data update is received after thewaitTime
has passed.
-
-
Method Details
-
update
-
cancelCurrentTask
protected void cancelCurrentTask() -
scheduleTask
-
notifyConsumer
-