Defined in: async-throttler.ts:6
Options for configuring an async throttled function
• TFn extends AnyAsyncFunction
optional enabled: boolean;
optional enabled: boolean;
Defined in: async-throttler.ts:11
Whether the throttler is enabled. When disabled, maybeExecute will not trigger any executions. Defaults to true.
optional leading: boolean;
optional leading: boolean;
Defined in: async-throttler.ts:16
Whether to execute the function immediately when called Defaults to true
optional onError: (error, asyncThrottler) => void;
optional onError: (error, asyncThrottler) => void;
Defined in: async-throttler.ts:20
Optional error handler for when the throttled function throws
unknown
AsyncThrottler<TFn>
void
optional onSettled: (asyncThrottler) => void;
optional onSettled: (asyncThrottler) => void;
Defined in: async-throttler.ts:24
Optional function to call when the throttled function is executed
AsyncThrottler<TFn>
void
optional onSuccess: (result, asyncThrottler) => void;
optional onSuccess: (result, asyncThrottler) => void;
Defined in: async-throttler.ts:28
Optional function to call when the throttled function is executed
ReturnType<TFn>
AsyncThrottler<TFn>
void
optional trailing: boolean;
optional trailing: boolean;
Defined in: async-throttler.ts:36
Whether to execute the function on the trailing edge of the wait period Defaults to true
wait: number;
wait: number;
Defined in: async-throttler.ts:41
Time window in milliseconds during which the function can only be executed once Defaults to 0ms
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.