Advertisement
Guest User

Untitled

a guest
May 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. // Для вызова функции не чаще чем в указанный интервал времени
  2. var my_debounce = function(func, wait) {
  3. var timeout;
  4. return function() {
  5. var context = this,
  6. args = arguments,
  7. later = function() {
  8. timeout = null;
  9. func.apply(context, args);
  10. };
  11. if (!timeout) {
  12. timeout = setTimeout(later, wait);
  13. }
  14. return timeout;
  15. };
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement