9.0 Released! → Native ESM runtimes 🚀, Vite support ⚡️, multi-window apps and more...
Read Announcement
ts
function debounce(
   fn: any, 
   delay?: number, 
   param2?: {
  leading?: boolean;
}): (...args: any[]) => void;

Defined in: utils/shared.ts

Creates a debounced function that delays invoking the provided function until after a specified delay

Parameters

ParameterTypeDescription
fnanyThe function to debounce
delay?numberThe number of milliseconds to delay
param2?{ leading?: boolean; }Options for the debounce behavior
param2.leading?boolean-

Returns

A new debounced function

(...args: any[]) => void