fixing documentation for throttle.

This commit is contained in:
Jeremy Ashkenas
2011-10-24 11:51:47 -04:00
parent 43878e8ef0
commit 456a69c559

View File

@@ -798,11 +798,12 @@ $(window).scroll(throttled);
<p id="debounce"> <p id="debounce">
<b class="header">debounce</b><code>_.debounce(function, wait)</code> <b class="header">debounce</b><code>_.debounce(function, wait)</code>
<br /> <br />
Repeated calls to a debounced function will postpone it's execution Calling a debounced function will postpone its execution until after
until after <b>wait</b> milliseconds have elapsed. Useful for implementing <b>wait</b> milliseconds have elapsed since the last time the function
behavior that should only happen <i>after</i> the input has stopped arriving. was invoked. Useful for implementing behavior that should only happen
For example: rendering a preview of a Markdown comment, recalculating a <i>after</i> the input has stopped arriving. For example: rendering a
layout after the window has stopped being resized... preview of a Markdown comment, recalculating a layout after the window
has stopped being resized...
</p> </p>
<pre> <pre>
var lazyLayout = _.debounce(calculateLayout, 300); var lazyLayout = _.debounce(calculateLayout, 300);