[Pkg-javascript-commits] [backbone] 179/211: clarified example; fixed typo

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:00:21 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.5.0
in repository backbone.

commit b28bb50520c54daec5d1fde1b807a50917ea29bf
Author: Loren Sands-Ramshaw <lorensr at gmail.com>
Date:   Sat Jun 4 19:42:16 2011 -0400

    clarified example; fixed typo
---
 index.html | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/index.html b/index.html
index 00eaafe..b879589 100644
--- a/index.html
+++ b/index.html
@@ -1142,15 +1142,25 @@ var alphabetical = Books.sortBy(function(book) {
     </p>
 
 <pre class="runnable">
-var ships = new Backbone.Collection;
+var Ship = Backbone.Model.extend({
+  defaults: {
+    "name":  "Black Pearl"
+  }
+});
+
+var Fleet = Backbone.Collection.extend({
+  model: Ship
+});
+
+var pirates = new Fleet();
 
-ships.bind("add", function(ship) {
+pirates.bind("add", function(ship) {
   alert("Ahoy " + ship.get("name") + "!");
 });
 
-ships.add([
+pirates.add([
   {name: "Flying Dutchman"},
-  {name: "Black Pearl"}
+  {captain: "Jack Sparrow"}
 ]);
 </pre>
 
@@ -1585,7 +1595,7 @@ $(function(){
     <h2 id="Sync">Backbone.sync</h2>
 
     <p>
-      <b>Backbone.sync</b> is the function the Backbone calls every time it
+      <b>Backbone.sync</b> is the function that Backbone calls every time it
       attempts to read or save a model to the server. By default, it uses
       <tt>(jQuery/Zepto).ajax</tt> to make a RESTful JSON request. You can override
       it in order to use a different persistence strategy, such as WebSockets,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list