Answers for "_.debounce"

5

debounce

function debounce(func, timeout = 300){
  let timer;
  return function(...args) {
    if (timer) {
      clearTimeout(timer);
    }
    
    timer = setTimeout(() => {
      func.apply(this, args);
    }, timeout);
  };
}
Posted by: Guest on February-15-2022
3

lodash debounce

_.debounce(func, [wait=0], [options={}])
Posted by: Guest on May-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language