UNPKG

chayns-components

Version:

A set of beautiful React components for developing chayns® applications.

20 lines (19 loc) 561 B
/** * Returns a wrapper function that executes `func` after it was not called for the last `delay` milliseconds * @param {(...args: any[]) => void} func * @param {number} delay */ const debounce = (func, delay) => { let timerId; return function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } clearTimeout(timerId); timerId = setTimeout(() => { func(...args); }, delay); }; }; export default debounce; //# sourceMappingURL=debounce.js.map