Skip to content

Instantly share code, notes, and snippets.

@wegry
Created February 21, 2019 11:04
Show Gist options
  • Save wegry/81a125b1f8a4549bf3cd12c8f7139da8 to your computer and use it in GitHub Desktop.
Save wegry/81a125b1f8a4549bf3cd12c8f7139da8 to your computer and use it in GitHub Desktop.
Minature debounce borrowed and tweaked from vue-js-tips
// https://github.com/vuejs-tips/tiny-debounce/blob/master/index.js
function debounce(fn, delay) {
let timeoutID = null;
return (...args) => {
clearTimeout(timeoutID);
timeoutID = setTimeout(() => {
fn(...args)
}, delay);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment