/** * @license * Copyright 2023 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ /** * Throttles a function call to limit execution frequency * Useful for performance optimization of frequently called functions * * @param func - Function to throttle * @param limit - Milliseconds to limit between calls * @returns Throttled function that will execute at most once per limit period * * @example * ```typescript * const throttledScroll = throttle((event) => { * console.log('Scroll event:', event); * }, 16); // 60fps limit * * window.addEventListener('scroll', throttledScroll); * ``` */ export declare function throttle any>(func: T, limit: number): (...args: Parameters) => void; /** * Debounces a function call to delay execution until after a period of inactivity * Useful for search inputs, resize handlers, etc. * * @param func - Function to debounce * @param delay - Milliseconds to wait after last call * @returns Debounced function that will execute after delay period of inactivity * * @example * ```typescript * const debouncedSearch = debounce((query: string) => { * console.log('Searching for:', query); * }, 300); // Wait 300ms after user stops typing * * input.addEventListener('input', (e) => debouncedSearch(e.target.value)); * ``` */ export declare function debounce any>(func: T, delay: number): (...args: Parameters) => void; /** * RAF (RequestAnimationFrame) throttle for smooth animations * Ensures function is called at most once per animation frame * * @param func - Function to throttle to animation frames * @returns Function that will execute at most once per animation frame * * @example * ```typescript * const rafThrottledUpdate = rafThrottle(() => { * // Expensive DOM updates * updateUI(); * }); * * element.addEventListener('mousemove', rafThrottledUpdate); * ``` */ export declare function rafThrottle any>(func: T): (...args: Parameters) => void; //# sourceMappingURL=utils.d.ts.map