PowerArgs.ActionDebouncer.ActionDebouncer C# (CSharp) Method

ActionDebouncer() public method

Creates the debouncer given a bust time window and an action callback.
public ActionDebouncer ( System.TimeSpan burstTimeWindow, System.Action callback ) : System
burstTimeWindow System.TimeSpan The time span that determines the time window. When a trigger fires, the debouncer will wait this amount of time before executing the callback. If a trigger fires before the time elapses, the timer is reset.
callback System.Action The action to execute when a trigger fires and the burst time window elapses.
return System
        public ActionDebouncer(TimeSpan burstTimeWindow, Action callback)
        {
            this.BurstTimeWindow = burstTimeWindow;
            this.callback = callback;
            this.endOfBurstTimerDetectionTimer = new Timer((o) => { callback(); }, null, Timeout.Infinite, Timeout.Infinite);
        }