After 2.5 years of development, version 1.0 of Backbone.js has been released. Backbone.js is the popular JavaScript Model/View library used for many popular single-page web applications, including USA Today, Rdio and Airbnb.
Backbone.js provides three core building blocks to the user:
- Models are used to represent persistable objects. Using Backbone.js' synchronization functionality, models can automatically synchronize with a remote data source (by default a RESTful web service). Similarly, it provides facilities to easily manage and synchronize collections of models with a data source.
- Views are used to construct and maintain the web application's UI. They can be configured to listen to change events of the models that they represent, making it easy to keep the UI up-to-date with the model and vice versa.
- The router supports navigation within a Backbone.js application. Although typical Backbone.js applications are single-page interfaces, it is still desirable to have bookmarkable URLs and to be able to use the browser's back button to navigate. Backone.js' router supports this functionality using HTML5's new history API, falling back to a URL hash when not supported.
Backbone.js 1.0 brings a few changes compared to the 0.9 series. Changes include a more intelligent way of bulk updating collections, automatic decoding of encoded URL segments and new listenTo and stopListening methods for event emitters. By default, model validation is now postponed until the model is saved, whereas in previous releases validation occurred immediately when setting properties. None of these changes are groundbreaking and therefore upgrading from 0.9 is expected to be fairly painless.
While it has been a long time coming, 1.0 is not the end of the road for Backbone.js. The announcement ends with an explicit call for new ideas:
The essential premise at the heart of Backbone has always been to try and discover the minimal set of data-structuring (Models and Collections) and user interface (Views and URLs) primitives that are useful when building web applications with JavaScript. We're going to keep hunting for that specific type of feature, and if you think that you've found one, please send it on in. In an ecosystem where overarching, decides-everything-for-you frameworks are commonplace, and many libraries require your site to be restructured to suit their look, feel, and default behavior -- Backbone should continue to be a tool that gives you the freedom to design the full experience of your web application.
Backbone.js 1.0 can be downloaded as a single JavaScript source file. The minimized and gzipped version is 6.3kB. Backbone.js has underscore.js as a dependency, as well as either jQuery or Zepto when using features that rely on the DOM, such as views and the router.