@polgubau/utils
Version:
A collection of utility functions for TypeScript
1 lines • 934 B
Source Map (JSON)
{"version":3,"sources":["../../../../src/functions/debounce/debounce.ts"],"sourcesContent":["/**\n * Creates a debounced function that delays invoking the provided function until after the specified delay.\n *\n * @param fn - The function to debounce.\n * @param delay - The number of milliseconds to delay.\n * @returns A new debounced function.\n */\n// biome-ignore lint/complexity/noBannedTypes: <explanation>\nexport function debounce(fn: Function, delay: number) {\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n let timer: any;\n // biome-ignore lint/suspicious/noExplicitAny: <explanation>\n return (...args: any[]) => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n fn(...args);\n }, delay);\n };\n}\n"],"mappings":";AAQO,SAAS,SAAS,IAAc,OAAe;AAEpD,MAAI;AAEJ,SAAO,IAAI,SAAgB;AACzB,iBAAa,KAAK;AAClB,YAAQ,WAAW,MAAM;AACvB,SAAG,GAAG,IAAI;AAAA,IACZ,GAAG,KAAK;AAAA,EACV;AACF;","names":[]}