Last active
August 29, 2015 14:03
Revisions
-
marksteve revised this gist
Jul 10, 2014 . 1 changed file with 1 addition and 2 deletions.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 @@ -1,10 +1,9 @@ var throttle = function(f, cd) { var _cd = new Date; return function() { if (_cd - new Date < 0) { _cd = new Date(new Date().getTime() + cd); return f.apply(this, arguments); } }; }; -
marksteve revised this gist
Jul 10, 2014 . 1 changed file with 1 addition and 1 deletion.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 @@ -4,7 +4,7 @@ var throttle = function(f, cd) { return function() { if (_cd - new Date < 0) { _cd = new Date(new Date().getTime() + cd); return f.apply(_this, arguments); } }; }; -
marksteve renamed this gist
Jul 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
marksteve revised this gist
Jul 10, 2014 . No changes.There are no files selected for viewing
-
marksteve created this gist
Jul 10, 2014 .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,17 @@ var throttle = function(f, cd) { var _this = this; var _cd = new Date; return function() { if (_cd - new Date < 0) { _cd = new Date(new Date().getTime() + cd); f.apply(_this, arguments); } }; }; /* var shout = throttle(function() { console.log('SHOUT!'); }, 1000); setInterval(shout, 100); */