mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-29 02:19:01 +00:00
docs: add documentation for Operand Search, remove debounce
This commit is contained in:
parent
23380d0519
commit
b10b23a47b
6 changed files with 63 additions and 21 deletions
assets/js
|
@ -15,15 +15,7 @@ async function searchContents(query) {
|
|||
return (await response.json());
|
||||
}
|
||||
|
||||
function debounce(func, timeout = 300) {
|
||||
let timer;
|
||||
return (...args) => {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => { func.apply(this, args); }, timeout)
|
||||
};
|
||||
}
|
||||
|
||||
registerHandlers(debounce((e) => {
|
||||
registerHandlers((e) => {
|
||||
term = e.target.value
|
||||
if (term !== "") {
|
||||
searchContents(term)
|
||||
|
@ -35,4 +27,4 @@ registerHandlers(debounce((e) => {
|
|||
))
|
||||
.then(results => displayResults(results))
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue