Guest User

Untitled

a guest
Jan 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. export const debounce = (func, delay = 300) => {
  2. let timeout;
  3. return function() {
  4. const self = this, args = arguments;
  5. const later = function() {
  6. timeout = null;
  7. func.apply(self, args);
  8. };
  9. clearTimeout(timeout);
  10. timeout = setTimeout(later, delay);
  11. };
  12. };
Add Comment
Please, Sign In to add comment