Just wanted to highlight a couple features that @brysgo and I contributed to these libraries using our beach time. They’ve since been accepted and merged.
First, backbone.js. We made a very simple change, one that hopefully makes a big difference to some —
routes used to only take a hash but it can now take a function as well! For an example of how to use this, please check out the test. Why would you want to do this? The primary motivation was that it allowed for an inheritance-like scheme for defining routes (which is clearly illustrated in the test). For a full discussion, please see the thread. There is a very similar mechanism for defining view’s events using either a hash or a function, so we simply made routes consistent with that.
Next, underscore.js. We added a subtle new feature to the
throttle() function where it takes an optional boolean flag indicating whether the throttled function gets called immediately at the start of the interval or at the trailing end of the interval. If you’re familiar with how the
debounce() function works, then it has the same effect as its third parameter.
Any thoughts on these features? Would love to hear from you especially if you end up using either of these!