frohzinn's picture
download
raw
512 Bytes
/**
* @param fn - The function to debounce
* @param delay - The delay in milliseconds
* @returns A debounced version of the function
*/
export function debounce<T extends (...args: Parameters<T>) => void>(
fn: T,
delay: number
): (...args: Parameters<T>) => void {
let timeoutId: ReturnType<typeof setTimeout> | null = null;
return (...args: Parameters<T>) => {
if (timeoutId) {
clearTimeout(timeoutId);
}
timeoutId = setTimeout(() => {
fn(...args);
timeoutId = null;
}, delay);
};
}

Xet Storage Details

Size:
512 Bytes
·
Xet hash:
497f8a931f8c0c84b01af20a39eeb17f50f81bf0a4f92191ffe2096047551eef

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.