Table of Contents

Interface IDebouncerBase<TEventArgs>

Namespace
Dorssel.Utilities.Generic
Assembly
Dorssel.Utilities.Debounce.dll

Interface for debouncers accumulating triggers and debouncing.

public interface IDebouncerBase<TEventArgs> where TEventArgs : DebouncedEventArgs

Type Parameters

TEventArgs

Properties

CurrentEventHandlersTask

Gets an awaitable Task running any current event handlers.

Task CurrentEventHandlersTask { get; }

Property Value

Task

DebounceTimeout

Gets or sets the maximum TimeSpan since the first Trigger() after which a new Debounced event will fire.

TimeSpan DebounceTimeout { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

DebounceWindow

Gets or sets the TimeSpan within which new calls to Trigger() will restart the debounce timer.

TimeSpan DebounceWindow { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

EventSpacing

Gets or sets the minimum TimeSpan between two consecutive starts of the Debounced event.

TimeSpan EventSpacing { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

HandlerSpacing

Gets or sets the minimum TimeSpan between the end of one Debounced event handler invocation and the start of the next.

TimeSpan HandlerSpacing { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

TimingGranularity

Gets or sets the TimeSpan within which multiple calls to Trigger() will be coalesced without rescheduling the timer.

TimeSpan TimingGranularity { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

Methods

Reset()

Resets the accumulated trigger count to 0 and cancels any ongoing debouncing.

long Reset()

Returns

long

The number of triggers that had been accumulated since the last event handler was called.

Remarks

This method may be called even after Dispose() has been called.

Trigger()

Accumulates one more trigger.

void Trigger()

Exceptions

ObjectDisposedException

The object has been disposed.

Events

Debounced

This event will be sent when Trigger() has been called one or more times and the debounce timer times out.

event EventHandler<TEventArgs> Debounced

Event Type

EventHandler<TEventArgs>