Answers for "debounce="300""

0

debounce="300"

function debounce_leading(func, timeout = 300){
  let timer;
  return (...args) => {
    if (!timer) {
      func.apply(this, args);
    }
    clearTimeout(timer);
    timer = setTimeout(() => {
      timer = undefined;
    }, timeout);
  };
}
Posted by: Guest on June-03-2021

Code answers related to "debounce="300""

Browse Popular Code Answers by Language