Class TimingAbstract
Methods
Staticdebounce
-
debounce<Args extends unknown[] = unknown[]>(
callback: (...args: Args) => void,
delay: number,
): (...args: Args) => voidWraps a callback in a debounced timeout. Delay execution of the callback function until the function has not been called for the given delay in milliseconds.
Type Parameters
- Args extends unknown[] = unknown[]
Parameters
- callback: (...args: Args) => void
A function to execute once the debounced threshold has been passed.
- delay: number
An amount of time in milliseconds to delay.
Returns (...args: Args) => void
A wrapped function that can be called to debounce execution.
StaticdoubleClick
-
doubleClick<E extends Event = Event>(
opts: {
delay: number;
double: (event: E) => void;
single: (event: E) => void;
},
): (event: E) => voidCreates a double click event handler that distinguishes between single and double clicks. Calls the
singlecallback on a single click and thedoublecallback on a double click. The default double click delay to invoke thedoublecallback is 400 milliseconds.Type Parameters
Parameters
Returns (event: E) => void
The gated double-click handler.
Provides timing related higher-order functions.