diff --git a/apps/web/lib/utils.ts b/apps/web/lib/utils.ts index bd0c391d..01262daf 100644 --- a/apps/web/lib/utils.ts +++ b/apps/web/lib/utils.ts @@ -1,6 +1,17 @@ -import { clsx, type ClassValue } from "clsx" -import { twMerge } from "tailwind-merge" +import { clsx, type ClassValue } from 'clsx' +import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } + +export function debounce void>( + func: T, + delay: number +): T { + let timeoutId: ReturnType + return function (this: any, ...args: Parameters) { + clearTimeout(timeoutId) + timeoutId = setTimeout(() => func.apply(this, args), delay) + } as T +}