File: jquery.ba-throttle-debounce.min.js

package info (click to toggle)
python-coverage 5.1+dfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,048 kB
  • sloc: python: 21,288; ansic: 1,212; javascript: 1,077; makefile: 217; sh: 106; xml: 42
file content (9 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
/*
 * jQuery throttle / debounce - v1.1 - 3/7/2010
 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);