MCPcopy Index your code
hub / github.com/github/awesome-copilot / debounce

Function debounce

website/src/scripts/utils.ts:343–356  ·  view source on GitHub ↗
(
  func: T,
  wait: number
)

Source from the content-addressed store, hash-verified

341 * Debounce function for search input
342 */
343export function debounce<T extends (...args: unknown[]) => void>(
344 func: T,
345 wait: number
346): (...args: Parameters<T>) => void {
347 let timeout: ReturnType<typeof setTimeout>;
348 return function executedFunction(...args: Parameters<T>) {
349 const later = () => {
350 clearTimeout(timeout);
351 func(...args);
352 };
353 clearTimeout(timeout);
354 timeout = setTimeout(later, wait);
355 };
356}
357
358/**
359 * Escape HTML to prevent XSS

Callers 1

setupSearchFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected