summaryrefslogtreecommitdiff
path: root/app/public/utils.js
diff options
context:
space:
mode:
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);
+ }
+}