claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
46 lines • 1.79 kB
TypeScript
/**
* Debounce function to limit the rate at which a function can fire
* @param func The function to debounce
* @param wait The number of milliseconds to delay
* @param immediate If true, trigger the function on the leading edge instead of the trailing
* @returns The debounced function
*/
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number, immediate?: boolean): (...args: Parameters<T>) => void;
/**
* Cancel a debounced function
* @param debouncedFunc The debounced function to cancel
*/
export declare function cancelDebounce(debouncedFunc: any): void;
/**
* Enhanced debounce with cancel and flush methods
* @param func The function to debounce
* @param wait The number of milliseconds to delay
* @param options Options for the debounce behavior
* @returns The debounced function with cancel and flush methods
*/
export declare function enhancedDebounce<T extends (...args: any[]) => any>(func: T, wait: number, options?: {
leading?: boolean;
trailing?: boolean;
maxWait?: number;
}): {
(...args: Parameters<T>): ReturnType<T> | undefined;
cancel: () => void;
flush: () => ReturnType<T> | undefined;
pending: () => boolean;
};
/**
* Throttle function to limit the rate at which a function can fire
* @param func The function to throttle
* @param wait The number of milliseconds to throttle
* @param options Options for the throttle behavior
* @returns The throttled function
*/
export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number, options?: {
leading?: boolean;
trailing?: boolean;
}): {
(...args: Parameters<T>): ReturnType<T> | undefined;
cancel: () => void;
flush: () => ReturnType<T> | undefined;
};
//# sourceMappingURL=debounce.d.ts.map