Skip to content

Instantly share code, notes, and snippets.

@rob-kistner
Last active April 19, 2020 20:05
Show Gist options
  • Select an option

  • Save rob-kistner/65737e2b6d56623195ce1536549f2c6c to your computer and use it in GitHub Desktop.

Select an option

Save rob-kistner/65737e2b6d56623195ce1536549f2c6c to your computer and use it in GitHub Desktop.
Debounce for Vue
export function debounce(fn, delay) {
let timeoutID = null;
return function() {
clearTimeout(timeoutID);
const args = arguments;
const _this = this;
timeoutID = setTimeout(function() {
fn.apply(_this, args);
}, delay);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment