Skip to content

Commit

Permalink
Remove debounce from search
Browse files Browse the repository at this point in the history
- Perf problems seems to be gone already
  • Loading branch information
pehala committed Nov 10, 2024
1 parent 124d882 commit e136f86
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions backend/templates/songs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,6 @@ <h6 class="d-inline" ><%:author%></h6>
import {Options, BooleanOption} from "{% static 'js/Options.js' %}"
const canWakeLock = () => 'wakeLock' in navigator;

function debounce(callback, delay = 1000) {
var time;

return (...args) => {
clearTimeout(time);
time = setTimeout(() => {
callback(...args);
}, delay);
};
}

let table = null
function createDatatable(paging, initialSearch) {
const options = {
Expand Down Expand Up @@ -259,13 +248,6 @@ <h6 class="d-inline" ><%:author%></h6>
$(".chord").show()
}
}
const search = debounce(
function ( val ) {
table.search(val);
table.draw(false);
console.log("searched")
}, 200
);

const config = new Map([
["hide_chords", new BooleanOption(document.getElementById("hideChords"), hideChords, false)],
Expand Down Expand Up @@ -322,7 +304,8 @@ <h6 class="d-inline" ><%:author%></h6>
});

document.getElementById("searchInput").addEventListener("input", function(event) {
search(event.target.value)
table.search(event.target.value);
table.draw(false);
})
</script>
{% endblock %}

0 comments on commit e136f86

Please sign in to comment.