From adc7104a7b36e52642b3f440356d305bf240ee9d Mon Sep 17 00:00:00 2001 From: Marc Friedman Date: Sat, 30 Mar 2013 21:45:57 -0400 Subject: [PATCH] More minor updates to recently changed sections. --- chapters/02-fundamentals.md | 2 +- chapters/06-extensions.md | 4 ++-- chapters/09-bbb.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chapters/02-fundamentals.md b/chapters/02-fundamentals.md index 71a871c3..17b9e7c7 100644 --- a/chapters/02-fundamentals.md +++ b/chapters/02-fundamentals.md @@ -201,7 +201,7 @@ This completes our first encounter with Backbone.js. The remainder of this book * When using Models in real-world applications we generally also need a way of persisting Models. Persistence allows us to edit and update Models with the knowledge that their most recent states will be saved somewhere, for example in a web browser's localStorage data-store or synchronized with a database. -* A Model may have one (or many) Views observing it for changes. By *observing* we mean that a View has registered an interest in being informed whenever an update is made to the Model. This allows the View to ensure that what is displayed on screen and what data is contained in the model are kept in sync. Depending on your requirements, you might create a single View displaying all Model attributes, or create separate Views displaying different attributes. The important point is that the Model doesn't care how these Views are organized, it simply announces updates to its data as necessary through the framework's event system. +* A Model may have multiple Views observing it for changes. By *observing* we mean that a View has registered an interest in being informed whenever an update is made to the Model. This allows the View to ensure that what is displayed on screen is kept in sync with the data contained in the model. Depending on your requirements, you might create a single View displaying all Model attributes, or create separate Views displaying different attributes. The important point is that the Model doesn't care how these Views are organized, it simply announces updates to its data as necessary through the framework's event system. * It is not uncommon for modern MVC/MV* frameworks to provide a means of grouping Models together. In Backbone, these groups are called "Collections." Managing Models in groups allows us to write application logic based on notifications from the group when a Model within the group changes. This avoids the need to manually observe individual Model instances. We'll see this in action later in the book. Collections are also useful for performing any aggregate computations across more than one model. diff --git a/chapters/06-extensions.md b/chapters/06-extensions.md index 6b72933b..1b3fba47 100644 --- a/chapters/06-extensions.md +++ b/chapters/06-extensions.md @@ -181,7 +181,7 @@ The problem is caused by the model event binding in the view's `initialize` meth Since the original view is still in scope, and the second view instance is also in scope, changing data on the model will cause both view instances to respond. -Fixing this is easy, though. You just need to call `off` when the view is done with its work and ready to be closed. To do this, add a `close` method to the view. +Fixing this is easy, though. You just need to call `stopListening` when the view is done with its work and ready to be closed. To do this, add a `close` method to the view. ```javascript var ZombieView = Backbone.View.extend({ @@ -206,7 +206,7 @@ var ZombieView = Backbone.View.extend({ }); ``` -Then call `close` on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the `listenTo` and `stopListening` functions, see the earlier chapter on internals and Derick's post on [Managing Events As Relationships, Not Just Resources](http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/). +Then call `close` on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the `listenTo` and `stopListening` functions, see the earlier Backbone Basics chapter and Derick's post on [Managing Events As Relationships, Not Just Resources](http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/). ```javascript var Jeremy = new Person({ diff --git a/chapters/09-bbb.md b/chapters/09-bbb.md index 153d0c46..21cea923 100644 --- a/chapters/09-bbb.md +++ b/chapters/09-bbb.md @@ -573,7 +573,7 @@ When building an application with Backbone, there's some additional tooling avai Backbone DevTools was created to help with this and is a Chrome DevTools extension allowing you to inspect events, syncs, View-DOM bindings and what objects have been instantiated. -A useful View hierarchy displayed in the Elements panel and you can also inspect a DOM element and the closest View will be exposed via $view in the console. +A useful View hierarchy is displayed in the Elements panel. Also, when you inspect a DOM element the closest View will be exposed via $view in the console. ![](img/bbdevtools.jpg)