Created
February 24, 2011 04:46
-
-
Save yoko/841770 to your computer and use it in GitHub Desktop.
using with onscroll, onresize etc.
This file contains 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(ns) { | |
ns.rarely = rarely(); | |
function rarely() { | |
var timer = null; | |
return rarely; | |
function rarely(f, every) { | |
every = every || 100; | |
if (!timer) { | |
f(); | |
timer = setTimeout(function() { | |
f(); | |
timer = null; | |
}, every); | |
} | |
} | |
} | |
})(this); |
Author
yoko
commented
Mar 1, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment