documentcloud/underscore — Issue #416: More explicit documentation for throttle, debounce.
Author: alanhogan
Created: 2011-12-23 01:47:32+00:00
State: open

A small jQuery library with `throttle` and `debounce` functionality has a [lovely and explicit](http://benalman.com/projects/jquery-throttle-debounce-plugin/) documentation page, even featuring graphics to illustrate with crystal clarity just how many times, and when, throttled and debounced functions fire.

From browsing the underscore docs, I’m not sure what happens if I use `throttle` set to, say, a **one second** interval, and then call the function returned by `throttle` **3** times within a one-second period — will the function passed to `throttle` execute once (at first invocation of the returned function), or twice (including a second execution after the one-second interval, with the 3rd and latest arguments & context)? Sometimes, the latter is preferred, as it (e.g.) ensures the final state reflects the latest available data.