Do not do too many request as we try the search in the contentManager.

Wait 200ms before doing the request. It will avoid contentManager to do
too many (and useless) requests.
This commit is contained in:
Matthieu Gautier 2018-12-10 12:51:16 +01:00
parent 7b1d302a78
commit f0e61d31bf

View File

@ -79,6 +79,12 @@ function init() {
onBooksChanged();
});
}
futurCall = null;
function setSearch(value) {
clearTimeout(futurCall);
futurCall = setTimeout(function(){contentManager.setSearch(value)}, 200);
}
</script>
<style>
body {
@ -172,7 +178,7 @@ details:hover {
<div id="app">
<div id="searchBar">
<form>
<input id="searchInput" type="text" placeholder="Search files" oninput="contentManager.setSearch(this.value)"/>
<input id="searchInput" type="text" placeholder="Search files" oninput="setSearch(this.value)"/>
</form>
</div>
<div id="bookList">