From 0d463de74adad6538bbff14997b8ba560b736301 Mon Sep 17 00:00:00 2001
From: Alan Hogan
+
+ This method returns a function; it does
+ not itself execute its first argument. You should call _.throttle
+ only once for each function you wish to debounce (not repeatedly!).
+ It is the function returned from that once call to _.throttle
+ that you should invoke on each occurrance of the event you wish to throttle.
var throttled = _.throttle(updatePosition, 100);
@@ -808,7 +815,18 @@ $(window).scroll(throttled);
was invoked. Useful for implementing behavior that should only happen
after the input has stopped arriving. For example: rendering a
preview of a Markdown comment, recalculating a layout after the window
- has stopped being resized...
+ has stopped being resized, etc.
+
+
+ Please note that the first invocation of a debounced function will *not*
+ immediately execute it, but rather, the first execution will be at least wait
+ milliseconds later.
+
+
+ As with throttle, this method returns a function; it does
+ not itself execute its first argument. You should call _.debounce
+ only once for each function you wish to debounce, and you should
+ call the returned function every time the event you wish to debounce occurs.
var lazyLayout = _.debounce(calculateLayout, 300);
From 3a225eada5f06fd7c3e146225d61c860a8db0a82 Mon Sep 17 00:00:00 2001
From: Alan Hogan
Date: Fri, 23 Dec 2011 16:48:56 -0800
Subject: [PATCH 2/2] Typo
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 6d866454a..9ec7b5f88 100644
--- a/index.html
+++ b/index.html
@@ -798,7 +798,7 @@ _.defer(function(){ alert('deferred'); });
This method returns a function; it does
not itself execute its first argument. You should call _.throttle
- only once for each function you wish to debounce (not repeatedly!).
+ only once for each function you wish to throttle (not repeatedly!).
It is the function returned from that once call to _.throttle
that you should invoke on each occurrance of the event you wish to throttle.