Defined in: async-debouncer.ts:7
Options for configuring an async debounced function
• TFn extends AnyAsyncFunction
optional enabled: boolean | (debouncer) => boolean;
optional enabled: boolean | (debouncer) => boolean;
Defined in: async-debouncer.ts:13
Whether the debouncer is enabled. When disabled, maybeExecute will not trigger any executions. Can be a boolean or a function that returns a boolean. Defaults to true.
optional leading: boolean;
optional leading: boolean;
Defined in: async-debouncer.ts:18
Whether to execute on the leading edge of the timeout. Defaults to false.
optional onError: (error, debouncer) => void;
optional onError: (error, debouncer) => void;
Defined in: async-debouncer.ts:24
Optional error handler for when the debounced function throws. If provided, the handler will be called with the error and debouncer instance. This can be used alongside throwOnError - the handler will be called before any error is thrown.
unknown
AsyncDebouncer<TFn>
void
optional onSettled: (debouncer) => void;
optional onSettled: (debouncer) => void;
Defined in: async-debouncer.ts:28
Optional callback to call when the debounced function is executed
AsyncDebouncer<TFn>
void
optional onSuccess: (result, debouncer) => void;
optional onSuccess: (result, debouncer) => void;
Defined in: async-debouncer.ts:32
Optional callback to call when the debounced function is executed
ReturnType<TFn>
AsyncDebouncer<TFn>
void
optional throwOnError: boolean;
optional throwOnError: boolean;
Defined in: async-debouncer.ts:38
Whether to throw errors when they occur. Defaults to true if no onError handler is provided, false if an onError handler is provided. Can be explicitly set to override these defaults.
optional trailing: boolean;
optional trailing: boolean;
Defined in: async-debouncer.ts:43
Whether to execute on the trailing edge of the timeout. Defaults to true.
wait: number | (debouncer) => number;
wait: number | (debouncer) => number;
Defined in: async-debouncer.ts:49
Delay in milliseconds to wait after the last call before executing. Can be a number or a function that returns a number. Defaults to 0ms
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.