-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjquery.timer-tools.min.js
More file actions
7 lines (7 loc) · 1.21 KB
/
jquery.timer-tools.min.js
File metadata and controls
7 lines (7 loc) · 1.21 KB
1
2
3
4
5
6
7
/*!
jquery.timer-tools v0.1.0
by Andrey Mikhaylov (lolmaus) lolmaus@gmail.com
inspired by https://code.google.com/p/jquery-debounce/
MIT license
*/
(function(){var t=[].slice;jQuery.extend({delay:function(t,n){return setTimeout(n,t)},debounceLast:function(n,e,l){var r,u;if(arguments.length<2)throw"debounceLast called with less than two arguments";return 2===arguments.length&&(r=[void 0,e],e=r[0],l=r[1]),u=null,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],e=e||this,clearTimeout(u),u=jQuery.delay(n,function(){return l.apply(e,r),u=null})}},debounceFirst:function(n,e,l){var r,u;if(arguments.length<2)throw"debounceFirst called with less than two arguments";return 2===arguments.length&&(r=[void 0,e],e=r[0],l=r[1]),u=null,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],e=e||this,u||l.apply(e,r),clearTimeout(u),u=jQuery.delay(n,function(){return u=null})}},throttle:function(n,e,l){var r,u;if(arguments.length<2)throw"throttle called with less than two arguments";return 2===arguments.length&&(r=[void 0,e],e=r[0],l=r[1]),u=null,function(){var r;if(r=1<=arguments.length?t.call(arguments,0):[],e=e||this,!u)return l.apply(e,r),u=jQuery.delay(n,function(){return u=null})}}})}).call(this);