Skip to content

Commit

Permalink
Debounce utility
Browse files Browse the repository at this point in the history
  • Loading branch information
UdaraJay committed Oct 28, 2023
1 parent 4c3ab1c commit 5d1a915
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/renderer/utils/debounce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const debounce = (func, delay) => {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => {
func(...args);
}, delay);
};
};

export default debounce;

0 comments on commit 5d1a915

Please sign in to comment.