mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
removing voluminous verbose verbiage
This commit is contained in:
30
index.html
30
index.html
@@ -790,17 +790,11 @@ _.defer(function(){ alert('deferred'); });
|
|||||||
<p id="throttle">
|
<p id="throttle">
|
||||||
<b class="header">throttle</b><code>_.throttle(function, wait)</code>
|
<b class="header">throttle</b><code>_.throttle(function, wait)</code>
|
||||||
<br />
|
<br />
|
||||||
Returns a throttled version of the function, that, when invoked repeatedly,
|
Creates and returns a new, throttled version of the passed function,
|
||||||
will only actually call the wrapped function at most once per every <b>wait</b>
|
that, when invoked repeatedly, will only actually call the original function
|
||||||
|
at most once per every <b>wait</b>
|
||||||
milliseconds. Useful for rate-limiting events that occur faster than you
|
milliseconds. Useful for rate-limiting events that occur faster than you
|
||||||
can keep up with.
|
can keep up with.
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
This method returns a function; it does
|
|
||||||
not itself execute its first argument. You should call <code>_.throttle</code>
|
|
||||||
only <em>once</em> for each function you wish to throttle (not repeatedly!).
|
|
||||||
It is the function returned from that once call to <code>_.throttle</code>
|
|
||||||
that you should invoke on each occurrance of the event you wish to throttle.
|
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
var throttled = _.throttle(updatePosition, 100);
|
var throttled = _.throttle(updatePosition, 100);
|
||||||
@@ -810,23 +804,13 @@ $(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 />
|
||||||
Calling a debounced function will postpone its execution until after
|
Creates and returns a new debounced version of the passed function that
|
||||||
<b>wait</b> milliseconds have elapsed since the last time the function
|
will postpone its execution until after
|
||||||
|
<b>wait</b> milliseconds have elapsed since the last time it
|
||||||
was invoked. Useful for implementing behavior that should only happen
|
was invoked. Useful for implementing behavior that should only happen
|
||||||
<i>after</i> the input has stopped arriving. For example: rendering a
|
<i>after</i> the input has stopped arriving. For example: rendering a
|
||||||
preview of a Markdown comment, recalculating a layout after the window
|
preview of a Markdown comment, recalculating a layout after the window
|
||||||
has stopped being resized, etc.
|
has stopped being resized, and so on.
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
Please note that the first invocation of a debounced function will *not*
|
|
||||||
immediately execute it, but rather, the first execution will be at least <var>wait</var>
|
|
||||||
milliseconds later.
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
As with <code>throttle</code>, this method returns a function; it does
|
|
||||||
not itself execute its first argument. You should call <code>_.debounce</code>
|
|
||||||
only <em>once</em> for each function you wish to debounce, and you should
|
|
||||||
call the returned function every time the event you wish to debounce occurs.
|
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
var lazyLayout = _.debounce(calculateLayout, 300);
|
var lazyLayout = _.debounce(calculateLayout, 300);
|
||||||
|
|||||||
Reference in New Issue
Block a user