diff options
author | Alexis Hovorka <[email protected]> | 2024-07-27 19:43:38 -0600 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2024-07-27 19:43:38 -0600 |
commit | 4702402484a773c0eccf7415d0318e367fb996e1 (patch) | |
tree | 54f4857f5664b7f40815c580493bf08adc4dbe88 /app/public/utils.js | |
parent | caa495340aef5b765bed193da51cd4bf48a4d570 (diff) |
Diffstat (limited to 'app/public/utils.js')
-rw-r--r-- | app/public/utils.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/public/utils.js b/app/public/utils.js new file mode 100644 index 0000000..2e08012 --- /dev/null +++ b/app/public/utils.js @@ -0,0 +1,10 @@ +export function debounce(fn, delay) { + let timeout = null; + return (...args) => { + if (timeout) clearTimeout(timeout); + timeout = setTimeout(() => { + timeout = null; + fn.apply(null, args); + }, delay||500); + } +} |