Created
June 4, 2015 14:39
-
-
Save desandro/cec70dd445875198d928 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce( fn, threshold ) { | |
var timeout; | |
return function() { | |
clearTimeout( timeout ); | |
var args = arguments; | |
var _this = this; | |
timeout = setTimeout( function() { | |
fn.apply( _this, args ); | |
}, threshold || 100 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment