Answers for "BasicDebounce"

CSS
0

BasicDebounce

/**
 * @param {Function} func
 * @param {number} wait
 */
function debounce(func, wait) {
  let timeout = null;
  return function(...args) {
    clearTimeout(timeout);
    timeout = setTimeout(() => {
      func.apply(this, args)
    }, wait)
  }
}
Posted by: Guest on December-10-2021

Browse Popular Code Answers by Language