Models should be able to be passed around throughout your app, and used anywhere that bit of data is needed. It often renders the data from a specific model, or number of models — but views can also be data-less chunks of UI that stand alone. Instead, views listen to the model events, and react or re-render themselves appropriately.A Collection helps you deal with a group of related models, handling the loading and saving of new models to the server and providing helper functions for performing aggregations or computations against a list of models.Aside from their own events, collections also proxy through all of the events that occur to models within them, allowing you to listen in one place for any change that might happen to any model in the collection.
gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
The project is hosted on Git Hub, and the annotated source code is available, as well as an online test suite, an example application, a list of tutorials and a long list of real-world projects that use Backbone.
Backbone is available for use under the MIT software license.
You can report bugs and discuss features on the Git Hub issues page, on Freenode IRC in the = 1.11.0), and json2for older Internet Explorer support.
(Mimics of the Underscore and j Query APIs, such as Lodash and Zepto, will also tend to work, with varying degrees of compatibility.) When working on a web application that involves a lot of Java Script, one of the first things you learn is to stop tying your data to the DOM.
It's all too easy to create Java Script applications that end up as tangled piles of j Query selectors and callbacks, all trying frantically to keep data in sync between the HTML UI, your Java Script logic, and the database on your server.For rich client-side applications, a more structured approach is often helpful.With Backbone, you represent your data as Models, which can be created, validated, destroyed, and saved to the server.Whenever a UI action causes an attribute of a model to change, the model triggers a "change" event; all the Views that display the model's state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information.In a finished Backbone app, you don't have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.Philosophically, Backbone is an attempt to discover the minimal set of data-structuring (models and collections) and user interface (views and URLs) primitives that are generally useful when building web applications with Java Script.