Interface IDebouncer<TData>
Interface for debouncers accumulating triggers and debouncing.
public interface IDebouncer<TData> : IDebouncerBase<DebouncedEventArgs<TData>>
Type Parameters
TDataData to accumulate when triggering
- Inherited Members
Properties
DataLimit
Gets or sets the maximum number of calls to Trigger(TData) after which a new Debounced event will fire.
int DataLimit { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
- ArgumentOutOfRangeException
The value is less than 1.
Methods
Reset(out IReadOnlyList<TData>)
Resets the accumulated trigger count to 0 and cancels any ongoing debouncing.
long Reset(out IReadOnlyList<TData> data)
Parameters
dataIReadOnlyList<TData>Accumulated data from each call to Trigger(TData) since the last event handler was called.
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(TData)
Accumulates one more trigger.
void Trigger(TData data)
Parameters
dataTDataData that accompanies the trigger.
Exceptions
- InvalidOperationException
More than DataLimit calls to Trigger(TData) while an event handler is currently being invoked.
- ObjectDisposedException
The object has been disposed.