let fn = (x) => { console.log("start " + x); }; let timer = null; function debounce(time, fn, ...argus) { if (timer) { window.clearTimeout(timer); } timer = setTimeout(() => { fn.apply(null, argus); timer = false; }, time); }