Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Для вызова функции не чаще чем в указанный интервал времени
- var my_debounce = function(func, wait) {
- var timeout;
- return function() {
- var context = this,
- args = arguments,
- later = function() {
- timeout = null;
- func.apply(context, args);
- };
- if (!timeout) {
- timeout = setTimeout(later, wait);
- }
- return timeout;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement