UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

13 lines (12 loc) 305 B
export function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>( fn: F, timeout: number, ): F { let timer: ReturnType<typeof setTimeout> return ((...args: Parameters<F>) => { clearTimeout(timer) timer = setTimeout(() => { fn.apply(fn, args) }, timeout) }) as F }