Skip to main content

Definition

Assembly: CloudNimble.BlazorEssentials.dll Namespace: CloudNimble.BlazorEssentials.Threading Inheritance: System.Object

Syntax

Summary

Provides methods to reduce the number of events that are fired, usually so that rapid, imperceptible changes are ignored.

Remarks

Throttle() ensures that events are throttled by the interval specified. Only the last event in the interval sequence of events fires. Debounce() fires an event only after the specified interval has passed in which no other pending event has fired. Only the last event in the sequence is fired. Adapted from https://weblog.west-wind.com/posts/2017/Jul/02/Debouncing-and-Throttling-Dispatcher-Events.

Constructors

.ctor

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

DelayCount

The number of events that have been dropped in a given interval.

Syntax

Property Value

Type: int

Remarks

This value is reset every time the built-in Timer elapses.

TimerStarted

The DateTime that a new Timer was started, in UTC.

Syntax

Property Value

Type: System.DateTime

Methods

Debounce

Debounce an event by resetting the event timeout every time the event is fired. The behavior is that the Action passed is fired only after events stop firing for the given timeout period. Use Debounce when you want events to fire only after events stop firing after the given interval timeout period. Wrap the logic you would normally use in your event code into the Action you pass to this method to debounce the event. Example: https://gist.github.com/RickStrahl/0519b678f3294e27891f4d4f0608519a

Syntax

Parameters

Dispose

Syntax

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

Throttle

This method throttles events by allowing only 1 event to fire for the given timeout period. Only the last event fired is handled - all others are ignored. Throttle will fire events every timeout ms even if additional events are pending. Use Throttle where you need to ensure that events fire at given intervals.

Syntax

Parameters

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?
  • System.IDisposable