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