let target = document.querySelector('#search');
let timerId = null;
target.oninput = function () {
let inputValue = this.value.trim();
let lastTime = performance.now();
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(function() {
if (performance.now() - lastTime > 1500 && inputValue) {
console.log('Send', inputValue);
}
}, 1500);
}