Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

For #387 - addresses point 2, references earlier chapter for listenTo…

…/stopListening
  • Loading branch information...
commit fd52da832accc09ed808623bab9537bf2e728557 1 parent a27605d
@addyosmani authored
View
BIN  backbone-fundamentals.epub
Binary file not shown
View
4 backbone-fundamentals.md
@@ -4260,7 +4260,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 Backbone documentation](http://backbonejs.org/#Events-listenTo), and my blog 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 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/).
```javascript
var Jeremy = new Person({
@@ -4363,7 +4363,7 @@ The next time we call the `show` method of the region, the region remembers that
Since the region handles calling `close` for us, and we're using the `listenTo` event binder in our view instance, we no longer have to worry about zombie views in our application.
-Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a `close` method, it will be called when the view is closed. If not, the Backbone.View built-in method, `remove`, will be called instead. If neither of these methods exist, nothing will be called and you will be responsible for cleaning up the events and other bits, yourself.
+Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a `close` method, it will be called when the view is closed. If not, the Backbone.View built-in method, `remove`, will be called instead.
### Marionette Todo app
View
7 backbone-fundamentals.rtf
@@ -3283,10 +3283,7 @@ Derick.set('email', 'derickbailey@example.com');\par}
\line
\}\line
\});\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Then call {\f1 close} on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the {\f1 listenTo} and {\f1 stopListening} functions, see {\field{\*\fldinst{HYPERLINK "http://backbonejs.org/#Events-listenTo"}}{\fldrslt{\ul
-the Backbone documentation
-}}}
-, and my blog post on {\field{\*\fldinst{HYPERLINK "http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/"}}{\fldrslt{\ul
+{\pard \ql \f0 \sa180 \li0 \fi0 Then call {\f1 close} on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the {\f1 listenTo} and {\f1 stopListening} functions, see the earlier chapter on internals and Derick\u8217's post on {\field{\*\fldinst{HYPERLINK "http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/"}}{\fldrslt{\ul
Managing Events As Relationships, Not Just Resources
}}}
.\par}
@@ -3366,7 +3363,7 @@ myRegion.show(view2);\par}
{\pard \ql \f0 \sa180 \li0 \fi0 When we use a region to manage the lifecycle of our views, and display the views in the DOM, the region itself handles these concerns. By passing a view instance into the {\f1 show} method of the region, it will call the render method on the view for us. It will then take the resulting {\f1 el} of the view and populate the DOM element.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 The next time we call the {\f1 show} method of the region, the region remembers that it is currently displaying a view. The region calls the {\f1 close} method on the view, removes it from the DOM, and then proceeds to run the render & display code for the new view that was passed in.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Since the region handles calling {\f1 close} for us, and we\u8217're using the {\f1 listenTo} event binder in our view instance, we no longer have to worry about zombie views in our application.\par}
-{\pard \ql \f0 \sa180 \li0 \fi0 Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a {\f1 close} method, it will be called when the view is closed. If not, the Backbone.View built-in method, {\f1 remove}, will be called instead. If neither of these methods exist, nothing will be called and you will be responsible for cleaning up the events and other bits, yourself.\par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a {\f1 close} method, it will be called when the view is closed. If not, the Backbone.View built-in method, {\f1 remove}, will be called instead.\par}
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Marionette Todo app\par}
{\pard \ql \f0 \sa180 \li0 \fi0 Having learned about Marionette\u8217's high-level concepts, let\u8217's explore refactoring the Todo application we created in our first exercise to use it. The complete code for this application can be found in Derick\u8217's TodoMVC {\field{\*\fldinst{HYPERLINK "https://github.com/derickbailey/todomvc/tree/marionette/labs/architecture-examples/backbone_marionette/js"}}{\fldrslt{\ul
fork
View
4 chapters/06-extensions.md
@@ -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 Backbone documentation](http://backbonejs.org/#Events-listenTo), and my blog 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 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/).
```javascript
var Jeremy = new Person({
@@ -309,7 +309,7 @@ The next time we call the `show` method of the region, the region remembers that
Since the region handles calling `close` for us, and we're using the `listenTo` event binder in our view instance, we no longer have to worry about zombie views in our application.
-Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a `close` method, it will be called when the view is closed. If not, the Backbone.View built-in method, `remove`, will be called instead. If neither of these methods exist, nothing will be called and you will be responsible for cleaning up the events and other bits, yourself.
+Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a `close` method, it will be called when the view is closed. If not, the Backbone.View built-in method, `remove`, will be called instead.
### Marionette Todo app
View
4 index.html
@@ -3616,7 +3616,7 @@ <h3 id="memory-management"><a href="#TOC">Memory Management</a></h3>
}
});</code></pre>
-<p>Then call <code>close</code> on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the <code>listenTo</code> and <code>stopListening</code> functions, see <a href="http://backbonejs.org/#Events-listenTo">the Backbone documentation</a>, and my blog post on <a href="http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/">Managing Events As Relationships, Not Just Resources</a>.</p>
+<p>Then call <code>close</code> on the first instance when it is no longer needed, and only one view instance will remain alive. For more information about the <code>listenTo</code> and <code>stopListening</code> functions, see the earlier chapter on internals and Derick’s post on <a href="http://lostechies.com/derickbailey/2013/02/06/managing-events-as-relationships-not-just-references/">Managing Events As Relationships, Not Just Resources</a>.</p>
<pre class="sourceCode javascript"><code class="sourceCode javascript"><span class="kw">var</span> Jeremy = <span class="kw">new</span> Person({
<span class="dt">firstName</span>: <span class="ch">&#39;Jeremy&#39;</span>,
<span class="dt">lastName</span>: <span class="ch">&#39;Ashkenas&#39;</span>,
@@ -3693,7 +3693,7 @@ <h3 id="region-management"><a href="#TOC">Region Management</a></h3>
<p>When we use a region to manage the lifecycle of our views, and display the views in the DOM, the region itself handles these concerns. By passing a view instance into the <code>show</code> method of the region, it will call the render method on the view for us. It will then take the resulting <code>el</code> of the view and populate the DOM element.</p>
<p>The next time we call the <code>show</code> method of the region, the region remembers that it is currently displaying a view. The region calls the <code>close</code> method on the view, removes it from the DOM, and then proceeds to run the render &amp; display code for the new view that was passed in.</p>
<p>Since the region handles calling <code>close</code> for us, and we’re using the <code>listenTo</code> event binder in our view instance, we no longer have to worry about zombie views in our application.</p>
-<p>Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a <code>close</code> method, it will be called when the view is closed. If not, the Backbone.View built-in method, <code>remove</code>, will be called instead. If neither of these methods exist, nothing will be called and you will be responsible for cleaning up the events and other bits, yourself.</p>
+<p>Regions are not limited to just Marionette views, though. Any valid Backbone.View can be managed by a Marionette.Region. If your view happens to have a <code>close</code> method, it will be called when the view is closed. If not, the Backbone.View built-in method, <code>remove</code>, will be called instead.</p>
<h3 id="marionette-todo-app"><a href="#TOC">Marionette Todo app</a></h3>
<p>Having learned about Marionette’s high-level concepts, let’s explore refactoring the Todo application we created in our first exercise to use it. The complete code for this application can be found in Derick’s TodoMVC <a href="https://github.com/derickbailey/todomvc/tree/marionette/labs/architecture-examples/backbone_marionette/js">fork</a>.</p>
<p>Our final implementation will be visually and functionally equivalent to the original app, as seen below.</p>
Please sign in to comment.
Something went wrong with that request. Please try again.