Revisions
-
mkuklis created this gist
Jun 7, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ function debounce(fn, wait) { var timeout = null; return function () { clearTimeout(timeout); var args = arguments; var ctx = this; timeout = setTimeout(function () { fn.apply(ctx, args); }, wait); } } function print(value) { console.log(value); } var printD = debounce(print, 100); printD(1); printD(2); printD(3);