Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sagartalla/8d320f317bd342cdd9f45cbe5d54a044 to your computer and use it in GitHub Desktop.

Select an option

Save sagartalla/8d320f317bd342cdd9f45cbe5d54a044 to your computer and use it in GitHub Desktop.

Revisions

  1. @abhinavnigam2207 abhinavnigam2207 created this gist Mar 5, 2019.
    9 changes: 9 additions & 0 deletions debounce-polyfill.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const debounce = (func, delay) => {
    let clearTimer;
    return function() {
    const context = this;
    const args = arguments;
    clearTimeout(clearTimer);
    clearTimer = setTimeout(() => func.apply(context, args), delay);
    }
    }