From 4702402484a773c0eccf7415d0318e367fb996e1 Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Sat, 27 Jul 2024 19:43:38 -0600 Subject: [refactor] Try out some client-side UI libraries --- app/public/utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/public/utils.js (limited to 'app/public/utils.js') 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); + } +} -- cgit v1.2.3-70-g09d2