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 voidprotected voidnotifyConsumer(T value) protected voidscheduleTask(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 theonDataCallbackafter the last data update.onDataCallback- The callback to call when thewaitTimehas 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, theonStartCallbackis called if one is provided. It will remain in the active state until thewaitTimehas passed without any new data updates. When that happens theonDataCallbackis called.- Parameters:
waitTime- The time to wait before calling theonDataCallbackafter the last data update.onDataCallback- The callback to call when thewaitTimehas passed without any new data updates.onStartCallback- The callback to call when the first data update is received after thewaitTimehas passed.
-
-
Method Details
-
update
-
cancelCurrentTask
protected void cancelCurrentTask() -
scheduleTask
-
notifyConsumer
-