Created
February 21, 2019 11:04
-
-
Save wegry/81a125b1f8a4549bf3cd12c8f7139da8 to your computer and use it in GitHub Desktop.
Minature debounce borrowed and tweaked from vue-js-tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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