twitter/typeahead.js — pull request #152 by jharding (2013-03-28 06:16:55+00:00)
Title: Improve transport logic (support batch requests)

Piggyback off of pending requests intelligently. Previously the following code would result in 2 separate requests being made to `https://twitter.com?q=query`:

```javascript
var transport1 = new Transport({
url: 'https://twitter.com?q=%QUERY'
}),
transport2 = new Transport({
url: 'https://twitter.com?q=%QUERY'
});

transport1.get('query');
transport2.get('query');
```

Now, before a transport makes a request to a url, it checks to see if there's already a pending request to that url and if there is, it'll rely on the response from that pending request.

The main benefit of this is that it's now possible to do batch requests i.e.

```javascript
$('.typeahead').typeahead([
{
name: 'colors',
remote: {
url: 'http://everything.com?q=%QUERY',
filter: function(resp) { return resp.colors; }
}
},
{
name: 'numbers',
remote: {
url: 'http://everything.com?q=%QUERY',
filter: function(resp) { return resp.numbers; }
}
}
]);
```

This pull request also fixes a bug mentioned in #94.