From ddd87c0e436fc6a1159df0d332b93229ce2cc946 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Mon, 4 Oct 2010 15:43:47 -0400 Subject: [PATCH] docs --- backbone.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/backbone.js b/backbone.js index 44fd0ca1..f1ea2ca3 100644 --- a/backbone.js +++ b/backbone.js @@ -1,8 +1,7 @@ -// Backbone.js -// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the terms of the MIT license. -// For all details and documentation: -// http://documentcloud.github.com/backbone +// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the terms of the MIT license. +// For all details and documentation: +// http://documentcloud.github.com/backbone (function(){ @@ -38,7 +37,13 @@ // ----------------- // A module that can be mixed in to any object in order to provide it with - // custom events. + // custom events. You may `bind` or `unbind` a callback function to an event; + // `trigger`-ing an event fires all callbacks in succession. + // + // _.extend(object, Backbone.Bindable); + // object.bind('expand', function(){ alert('expanded'); }); + // object.trigger('expand'); + // Backbone.Bindable = { // Bind an event, specified by a string name, `ev`, to a `callback` function. @@ -73,7 +78,7 @@ return this; }, - // Trigger an event, firing all bound callbacks + // Trigger an event, firing all bound callbacks. trigger : function(ev) { var calls = this._callbacks; for (var i = 0; i < 2; i++) {