Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

debounce javascript

let timeout;  

const debounce = (callback, wait) => {
    return (...args) => {
      clearTimeout(timeout);
      timeout = setTimeout(function () {
        callback.apply(this, args);
      }, wait);
    };
  };

const exampleFn = () => {
  console.log('Hello Word')
};

debounce(exampleFn, 1000);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #debounce #javascript
ADD COMMENT
Topic
Name
8+9 =