Last active
April 19, 2020 20:05
-
-
Save rob-kistner/65737e2b6d56623195ce1536549f2c6c to your computer and use it in GitHub Desktop.
Debounce for Vue
This file contains hidden or 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
| 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