From 8ea1525df40751af2702a508c3ecf2edf2d76107 Mon Sep 17 00:00:00 2001
From: Seth <37915796+iSaluki@users.noreply.github.com>
Date: Mon, 03 Oct 2022 18:45:54 +0000
Subject: [PATCH] Add SethMB Work (#203)
---
assets/js/semantic-search.js | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/assets/js/semantic-search.js b/assets/js/semantic-search.js
index 3cebe5a..4382817 100644
--- a/assets/js/semantic-search.js
+++ b/assets/js/semantic-search.js
@@ -15,7 +15,15 @@
return (await response.json());
}
-registerHandlers((e) => {
+function debounce(func, timeout = 200) {
+ let timer;
+ return (...args) => {
+ clearTimeout(timer)
+ timer = setTimeout(() => { func.apply(this, args); }, timeout)
+ };
+}
+
+registerHandlers(debounce((e) => {
term = e.target.value
if (term !== "") {
searchContents(term)
@@ -27,4 +35,4 @@
))
.then(results => displayResults(results))
}
-})
+}))
--
Gitblit v1.10.0