1var ships = new Backbone.Collection;
2
3ships.on("add", function(ship) {
4 alert("Ahoy " + ship.get("name") + "!");
5});
6
7ships.add([
8 {name: "kjnFlying Dutchman"},
9 {name: "Black Pearl"}
10]);
11
1var ViewName = Backbone.View.extend({
2 initialize: function(){
3 this.$el.on("eventName", this.functionName, this)
4 },
5 functionName: function(){
6 //whatever
7 },
8 remove: function() {
9 this.$el.off("eventName", this.functionName);
10 Backbone.View.prototype.remove.apply(this, arguments);
11 }
12});