Defined in: async-debouncer.ts:69
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:75
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 initialState: Partial<AsyncDebouncerState<TFn>>;
optional initialState: Partial<AsyncDebouncerState<TFn>>;
Defined in: async-debouncer.ts:79
Initial state for the async debouncer
optional key: string;
optional key: string;
Defined in: async-debouncer.ts:84
Optional key to identify this async debouncer instance. If provided, the async debouncer will be identified by this key in the devtools and PacerProvider if applicable.
optional leading: boolean;
optional leading: boolean;
Defined in: async-debouncer.ts:89
Whether to execute on the leading edge of the timeout. Defaults to false.
optional onError: (error, args, debouncer) => void;
optional onError: (error, args, debouncer) => void;
Defined in: async-debouncer.ts:95
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
Parameters<TFn>
AsyncDebouncer<TFn>
void
optional onSettled: (args, debouncer) => void;
optional onSettled: (args, debouncer) => void;
Defined in: async-debouncer.ts:103
Optional callback to call when the debounced function is executed
Parameters<TFn>
AsyncDebouncer<TFn>
void
optional onSuccess: (result, args, debouncer) => void;
optional onSuccess: (result, args, debouncer) => void;
Defined in: async-debouncer.ts:107
Optional callback to call when the debounced function is executed
ReturnType<TFn>
Parameters<TFn>
AsyncDebouncer<TFn>
void
optional throwOnError: boolean;
optional throwOnError: boolean;
Defined in: async-debouncer.ts:117
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:122
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:128
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.