Files
MermsPanelReactJS/src/utils/debounceFunction.js
T
victorAnumudu 943818aafa drop down fix
2024-12-07 07:10:08 +01:00

15 lines
382 B
JavaScript

function debounceFunction(func, delay) {
let timer;
return function(...args) {
// Clear the previous timer if the function is called before the delay
clearTimeout(timer);
// Set a new timer to execute the function after the specified delay
timer = setTimeout(() => {
func(...args);
}, delay);
};
}
export default debounceFunction