WIM/WIM4.1/tp/tp3/ex2/js/helpers.js
2022-05-10 12:21:29 +02:00

20 lines
367 B
JavaScript

function debounce(fn, wait)
{
let timeout;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(() => fn(...args), wait);
}
}
function autocomplete(datalist,communes)
{
// À compléter
datalist.innerHTML = '';
for(let c of communes) {
let option = document.createElement("option");
option.value = c;
datalist.appendChild(option);
}
}