UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

17 lines (16 loc) 508 B
export const debounce = (func, waitFor) => { let timeout; return function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return new Promise(resolve => { if (timeout) { clearTimeout(timeout); } // eslint-disable-next-line @typescript-eslint/no-unsafe-argument timeout = setTimeout(() => resolve(func(...args)), waitFor); }); }; }; //# sourceMappingURL=debounce.js.map