summaryrefslogtreecommitdiff
path: root/app/public/utils.js
diff options
context:
space:
mode:
authorAlexis Hovorka <[email protected]>2024-07-27 19:43:38 -0600
committerAlexis Hovorka <[email protected]>2024-07-27 19:43:38 -0600
commit4702402484a773c0eccf7415d0318e367fb996e1 (patch)
tree54f4857f5664b7f40815c580493bf08adc4dbe88 /app/public/utils.js
parentcaa495340aef5b765bed193da51cd4bf48a4d570 (diff)
[refactor] Try out some client-side UI librariesHEADmain
Diffstat (limited to 'app/public/utils.js')
-rw-r--r--app/public/utils.js10
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);
+ }
+}