fix tax log
This commit is contained in:
19
frontend/src/lib/utils/debounce.js
Normal file
19
frontend/src/lib/utils/debounce.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Debounce utility function
|
||||
* Delays the execution of a function until a specified time has passed since the last call
|
||||
*
|
||||
* @param {Function} func - The function to debounce
|
||||
* @param {number} wait - The delay in milliseconds
|
||||
* @returns {Function} - The debounced function
|
||||
*/
|
||||
export function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function executedFunction(...args) {
|
||||
const later = () => {
|
||||
clearTimeout(timeout);
|
||||
func(...args);
|
||||
};
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user