Class Debouncer
-
- All Implemented Interfaces:
@Deprecated(message = "Use the one from stream-chat-android-core", replaceWith = @ReplaceWith(imports = {"io.getstream.chat.android.core.utils.Debouncer"}, expression = "Debouncer(debounceMs)"), level = DeprecationLevel.WARNING) public final class Debouncer
Utility class for debouncing high frequency events.
submitting a new piece of work to run within the debounce window will cancel the previously submitted pending work.
-
-
Method Summary
Modifier and Type Method Description final Unitsubmit(Function0<Unit> work)Cancels the previous work and launches a new coroutine containing the new work. final UnitsubmitSuspendable(SuspendFunction0<Unit> work)Cancels the previous work and launches a new coroutine containing the new suspendable work. final UnitcancelLastDebounce()Cancels the current work without shutting down the Coroutine scope. final Unitshutdown()Cleans up any pending work. -
-
Constructor Detail
-
Debouncer
Debouncer(Long debounceMs)
-
-
Method Detail
-
submit
final Unit submit(Function0<Unit> work)
Cancels the previous work and launches a new coroutine containing the new work.
-
submitSuspendable
final Unit submitSuspendable(SuspendFunction0<Unit> work)
Cancels the previous work and launches a new coroutine containing the new suspendable work.
-
cancelLastDebounce
final Unit cancelLastDebounce()
Cancels the current work without shutting down the Coroutine scope.
-
-
-
-