BinaryMuse/ngInfiniteScroll — pull request #40 by neoeno (2014-01-16 00:12:51+00:00)
Title: Add throttling based on underscore’s implementation + tests.

This is to add throttling functionality for scroll events. I know there are a fair few rejected pull requests for this, but this one not only [I hope] passes all the existing tests, and more!

It's disabled by default, and is enabled by setting a angular `.value` on the module, like so:

```javascript
// Probably just after the original module declaration?
angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 100)
```

For me it made the most sense to set this throttling generally rather than as an attribute for the directive — having different throttling values for different instances of the directive would seem an unusual use case.

The throttling itself is a slimmed down version of [underscore's implementation](http://underscorejs.org/#throttle) — which executes as often as possible but not more than once per `wait` milliseconds. So it will execute immediately, and after the last call. Underscore's docs explain it better.

The tests are limited in scope due to Angular v 1.1 not supporting more granular `$timeout` mocking — this is introduced in v 1.2. I'm pretty new to javascript tests so there's quite a lot of duplicate code, but they do all pass at least!

Thanks again for your work.