It adds models, views, controllers, events, history and collections to JavaScript's capabilities.
Packed, comes at under 2KB.
Backbone supplies structure to JavaScript-heavy applications by providing models key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to existing applications over a RESTful JSON interface.
What is new in this release:
- Added listenToOnce as the analogue of once.
- Added the findWhere method to Collections, similar to where.
- Added the keys, values, pairs, invert, pick, and omit Underscore.js methods to Backbone Models.
- The routes in a Router's route map may now be function literals, instead of references to methods, if you like.
What is new in version 1.1.2:
- Added listenToOnce as the analogue of once.
- Added the findWhere method to Collections, similar to where.
- Added the keys, values, pairs, invert, pick, and omit Underscore.js methods to Backbone Models.
- The routes in a Router's route map may now be function literals, instead of references to methods, if you like.
What is new in version 0.9.10:
- A "route" event is triggered on the router in addition to being fired on Backbone.history.
- Model validation is now only enforced by default in Model#save and no longer enforced by default upon construction or in Model#set, unless the {validate:true} option is passed.
- View#make has been removed. You'll need to use $ directly to construct DOM elements now.
- Passing {silent:true} on change will no longer delay individual "change:attr" events, instead they are silenced entirely.
- The Model#change method has been removed, as delayed attribute changes as no longer available.
- Bug fix on change where attribute comparison uses !== instead of _.isEqual.
What is new in version 0.9.9:
- When using add on a collection, passing {merge: true} will now cause duplicate models to have their attributes merged in to the existing models, instead of being ignored.
- Added update (which also available as an option to fetch) for "smart" updating of sets of models.
- HTTP PATCH support in save by passing {patch: true}.
- The Backbone object now extends Events so that you can use it as a global event bus, if you like.
- Added a "request" event to Backbone.sync, which triggers whenever a request begins to be made to the server. The natural complement to the "sync" event.
- Router URLs now support optional parts via parentheses, without having to use a regex.
- Backbone events now supports once, similar to Node's once, or jQuery's one.
What is new in version 0.9.2:
- Instead of throwing an error when adding duplicate models to a collection, Backbone will now silently skip them instead.
- Added push, pop, unshift, and shift to collections.
- A model's changed hash is now exposed for easy reading of the changed attribute delta, since the model's last "change" event.
- Added where to collections for simple filtering.
- Can now use a single off call to remove all callbacks bound to a specific object.
- Bug fixes for nested individual change events, some of which may be "silent".
- Bug fixes for URL encoding in location.hash fragments.
- Bug fix for client-side validation in advance of a save call with {wait: true}.
- Updated / refreshed the example Todo List app.
What is new in version 0.9.0:
- When you don't know the key in advance, you may now call model.set(key, value) as well as save.
- Multiple models with the same id are no longer allowed in a single collection.
- Added a "sync" event, which triggers whenever a model's state has been successfully synced with the server (create, save, destroy).
- bind and unbind have been renamed to on and off for clarity, following jQuery's lead. The old names are also still supported.
- A Backbone collection's comparator function may now behave either like a sortBy (pass a function that takes a single argument), or like a sort (pass a comparator function that expects two arguments). The comparator function is also now bound by default to the collection - so you can refer to this within it.
- A view's events hash may now also contain direct function values as well as the string names of existing view methods.
- Added shuffle and initial to collections, proxied from Underscore.
- Model#urlRoot may now be defined as a function as well as a value.
- View#attributes may now be defined as a function as well as a value.
- Calling fetch on a collection will now cause all fetched JSON to be run through the collection's model's parse function, if one is defined.
What is new in version 0.5.3:
- A View's events property may now be defined as a function, as well as an object literal, making it easier to programmatically define and inherit events.
- groupBy is now proxied from Underscore as a method on Collections.
- If the server has already rendered everything on page load, pass Backbone.history.start({silent: true}) to prevent the initial route from triggering. Bugfix for pushState with encoded URLs.
What is new in version 0.5.2:
- The bind function, can now take an optional third argument, to specify the this of the callback function.
- Multiple models with the same id are now allowed in a collection.
- Fixed a bug where calling .fetch(jQueryOptions) could cause an incorrect URL to be serialized.
- Fixed a brief extra route fire before redirect, when degrading from pushState.
What is new in version 0.5.1:
- Improved transparent upgrades from hash-based URLs to pushState, and vice-versa.
- Fixed inconsistency with non-modified attributes being passed to Model#initialize.
- Reverted a 0.5.0 change that would strip leading hashbangs from routes.
- Added contains as an alias for includes.
What is new in version 0.5.0:
- A large number of tiny tweaks and micro bugfixes, best viewed by looking at the commit diff. HTML5 pushState support, enabled by opting-in with: Backbone.history.start({pushState: true}).
- Controller was renamed to Router, for clarity.
- Collection#refresh was renamed to Collection#reset to emphasize its ability to both reset the collection with new models, as well as empty out the collection when used with no parameters. saveLocation was replaced with navigate.
- RESTful persistence methods (save, fetch, etc.) now return the jQuery deferred object for further success/error chaining and general convenience.
- Improved XSS escaping for Model#escape.
- Added a urlRoot option to allow specifying RESTful urls without the use of a collection.
- An error is thrown if Backbone.history.start is called multiple times.
- Collection#create now validates before initializing the new model. view.el can now be a jQuery string lookup.
- Backbone Views can now also take an attributes parameter.
- Model#defaults can now be a function as well as a literal attributes object.
Requirements:
- JavaScript enabled on client side
Comments not found