collection.filter

filter (select)

all event

"all" â this special event fires for any triggered event, passing the event name as the first argument followed by all trigger arguments.

collection.contains

contains (includes)

collection.reduce

reduce (foldl, inject)

change event

"change" (model, options) â when a model's attributes have changed.

collection.length

lengthcollection.length Like an array, a Collection maintains a length property, counting the number of models it contains.

Backbone.off

offobject.off([event], [callback], [context])Alias: unbind Remove a previously-bound callback function from an object. If no context is specified, all of the versions of the callback with different contexts will be removed. If no callback is specified, all callbacks for the event will be removed. If no event is specified, callbacks for all events will be removed. // Removes just the `onChange` callback. object.off("change", onChange); // Removes all "change" callbacks. object.off("change")

collection.where

wherecollection.where(attributes) Return an array of all the models in a collection that match the passed attributes. Useful for simple cases of filter. var friends = new Backbone.Collection([ {name: "Athos", job: "Musketeer"}, {name: "Porthos", job: "Musketeer"}, {name: "Aramis", job: "Musketeer"}, {name: "d'Artagnan", job: "Guard"}, ]); var musketeers = friends.where({job: "Musketeer"}); alert(musketeers.length);

collection.clone

clonecollection.clone() Returns a new instance of the collection with an identical list of models.

model.defaults

defaultsmodel.defaults or model.defaults() The defaults hash (or function) can be used to specify the default attributes for your model. When creating an instance of the model, any unspecified attributes will be set to their default value. var Meal = Backbone.Model.extend({ defaults: { "appetizer": "caesar salad", "entree": "ravioli", "dessert": "cheesecake" } }); alert("Dessert will be " + (new Meal).get('dessert')); Remember that in JavaScript, objects are passe