UNPKG

react-native-a11y

Version:

Improvements of a11y for ReactNative, this library improve work with reader and keyboard focus and reader in general.

12 lines (11 loc) 341 B
export const debounce = <T extends Function>(callback: T, timeout = 100) => { let timer: NodeJS.Timeout | null; // eslint-disable-next-line @typescript-eslint/no-explicit-any return (...args: any) => { if (timer) { clearTimeout(timer); timer = null; } timer = setTimeout(() => callback(args), timeout); }; };