Model

constructor / initializenew Model([attributes], [options]) When creating an instance of a model, you can pass in the initial values of the attributes, which will be set on the model. If you define an initialize function, it will be invoked when the model is created. new Book({ title: "One Thousand and One Nights", author: "Scheherazade" }); In rare cases, if you're looking to get fancy, you may want to override constructor, which allows you to replace the actual constructor function f

model.get

getmodel.get(attribute) Get the current value of an attribute from the model. For example: note.get("title")

Backbone.stopListening

stopListeningobject.stopListening([other], [event], [callback]) Tell an object to stop listening to events. Either call stopListening with no arguments to have the object remove all of its registered callbacks ... or be more precise by telling it to remove just the events it's listening to on a specific object, or a specific event, or just a specific callback. view.stopListening(); view.stopListening(model);

view.events

eventsview.events or view.events() The events hash (or method) can be used to specify a set of DOM events that will be bound to methods on your View through delegateEvents. Backbone will automatically attach the event listeners at instantiation time, right before invoking initialize. var ENTER_KEY = 13; var InputView = Backbone.View.extend({ tagName: 'input', events: { "keydown" : "keyAction", }, render: function() { ... }, keyAction: function(e) { if (e.which === EN

route event

"route" (route, params) â Fired by the router when any route has been matched.

Router.extend

extendBackbone.Router.extend(properties, [classProperties]) Get started by creating a custom router class. Define actions that are triggered when certain URL fragments are matched, and provide a routes hash that pairs routes to actions. Note that you'll want to avoid using a leading slash in your route definitions: var Workspace = Backbone.Router.extend({ routes: { "help": "help", // #help "search/:query": "search", // #search/kiwis "search/:query/p

model.clear

clearmodel.clear([options]) Removes all attributes from the model, including the id attribute. Fires a "change" event unless silent is passed as an option.

collection.sync

synccollection.sync(method, collection, [options]) Uses Backbone.sync to persist the state of a collection to the server. Can be overridden for custom behavior.

view.delegateEvents

delegateEventsdelegateEvents([events]) Uses jQuery's on function to provide declarative callbacks for DOM events within a view. If an events hash is not passed directly, uses this.events as the source. Events are written in the format {"event selector": "callback"}. The callback may be either the name of a method on the view, or a direct function body. Omitting the selector causes the event to be bound to the view's root element (this.el). By default, delegateEvents is called within the View'

collection.add

addcollection.add(models, [options]) Add a model (or an array of models) to the collection, firing an "add" event for each model, and an "update" event afterwards. If a model property is defined, you may also pass raw attributes objects, and have them be vivified as instances of the model. Returns the added (or preexisting, if duplicate) models. Pass {at: index} to splice the model into the collection at the specified index. If you're adding models to the collection that are already in the co