@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
19 lines (18 loc) • 525 B
JavaScript
export var DEBOUNCE_DEFAULT_DELAY = 200;
export default function debounce(func, delay) {
if (delay === void 0) { delay = DEBOUNCE_DEFAULT_DELAY; }
var timeout;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(function () {
timeout = null;
func.apply(void 0, args);
}, delay);
};
}