UNPKG

@sap-ux/ui-components

Version:

SAP UI Components Library

17 lines 582 B
/** * Returns a function which calls the callback function only after the specified idle time. * * @param callback Function to execute * @param delay Idle period in milliseconds after which the callback will be executed * @returns A wrapper function that should be called to invoke the callback function after delay */ export function debounce(callback, delay) { let timerId; return (...args) => { clearTimeout(timerId); timerId = window.setTimeout(() => { callback(...args); }, delay); }; } //# sourceMappingURL=Debounce.js.map