Add this tiny plugin by Ben Alman to Drupal core to handle efficiently events (scroll and resize specially), and it can be useful in other cases: not letting hitting submit button more than x times per second, etc.
http://benalman.com/projects/jquery-throttle-debounce-plugin/
It's double-licensed GPL-MIT, so no problems there.

My reasoning is explained in this blog post, where I've visualized and tested different implementations: (Alman's jQuery plugin, underscore.js and lodash.js)
http://drupalmotion.com/article/debounce-and-throttle-visual-explanation

There has been some thoughts already before of adding similar functionality (some comments of _nod and Kiphaas7 and jessebeach)
http://drupal.org/search/apachesolr_multisitesearch/debounce

If underscore.js gets into Core #1149866: Add Backbone.js and Underscore.js to core then we could remove Ben's plugin, both implementations are equivalent.

Comments

seutje’s picture

Status: Needs review » Closed (duplicate)

since #1149866: Add Backbone.js and Underscore.js to core went in, I'ma mark this as duplicate.