backbone.js:Backbone.sync
> // Make the request, allowing the user to override any Ajax options.
> var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
Backbone allows delegating and undelegating single events on view classes as stated in the [annotated source](http://backbonejs.org/docs/backbone.html#section-163). This pull requests add the two methods to the View class.
The History.started flag is set on the class rather than on the class instance (as it is set once globally). Attempts to read *Backbone.history.started* (via the global history instance) always return undefined. Instead the typing should be static member (*Backbone.History.started* is where the correct value is located). This can be seen at http://backbonejs.org/docs/backbone.html#section-203
I removed the hard reference to the underscore typings. Keeping this reference in here makes it impossible to mix lodash and underscore in the same projects. In my case, another library is bringing in lodash, so I don't really have a choice.
By leaving out this reference, underscore or lodash can be included separately, and the user will still get typing information on that.
Union types available in typescript as of 1.4. Some semantically identical overloaded function definitions have been tidied up into single definitions.
The following syntax is supported in Backbone, but is currently not compileable in Typescript:
var data = [
{ id: 1, bar: 'foo' },
{ id: 2, bar: 'baz' }
];
var myCollection = new Backbone.Collection(data);
As of now, the constructor expects an array of models. I've added the Object[] parameter type, in addition to the TModel[] type to support this syntax.
http://backbonejs.org/#Utility-Backbone-$
Also removed `setDomLibrary`
Backbone change log 0.9.9 — Dec. 13, 2012:
To set what library Backbone uses for DOM manipulation and Ajax calls,
use `Backbone.$ = ...` instead of `setDomLibrary`.