Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const debounce = (func, delay = 300) => {
- let timeout;
- return function() {
- const self = this, args = arguments;
- const later = function() {
- timeout = null;
- func.apply(self, args);
- };
- clearTimeout(timeout);
- timeout = setTimeout(later, delay);
- };
- };
Add Comment
Please, Sign In to add comment