namespace Azaion.Annotator.Extensions; public static class ThrottleExt { private static bool _throttleOn; public static async Task Throttle(Func func, TimeSpan? throttleTime = null) { if (_throttleOn) return; _throttleOn = true; await func(); await Task.Delay(throttleTime ?? TimeSpan.FromMilliseconds(500)); _throttleOn = false; } }