Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of github.com:thoughtbot/backbone-support

  • Loading branch information...
commit 10b7234270fe5dff9445b8c7f4a65eb4a73e14f9 2 parents 11ece82 + 1429346
Chad Pytel authored

Showing 2 changed files with 13 additions and 7 deletions. Show diff stats Hide diff stats

  1. +11 7 README.md
  2. +2 0  spec/javascripts/support/jasmine.yml
18 README.md
Source Rendered
... ... @@ -1,11 +1,16 @@
1   -Helper and utility classes that fill out Backbone for serious development.
  1 +There's no built-in garbage collection for Backbone’s event bindings, and
  2 +forgetting to unbind can cause bugs and memory leaks.
  3 +
  4 +Backbone Support currently provides two utility classes, SwappingRouter and CompositeView,
  5 +that introduce a `leave()` function, which unbinds and cleans up the view.
  6 +They should be used where views are instantiated (in Router instances and in composite views).
2 7
3 8 Inspired by our projects and the Backbone.js on Rails book:
4 9 http://workshops.thoughtbot.com/backbone-js-on-rails
5 10
6 11 The book contains complete instructions and in-depth coverage of the internals
7   -of CompositeView and Swappingrouter, and an example application that shows
8   -their usage
  12 +of CompositeView and SwappingRouter, and an example application that shows
  13 +their usage.
9 14
10 15 ### SwappingRouter
11 16
@@ -25,7 +30,7 @@ view by rendering that view into its own `el`:
25 30 if (this.currentView && this.currentView.leave) {
26 31 this.currentView.leave();
27 32 }
28   -
  33 +
29 34 this.currentView = newView;
30 35 $(this.el).empty().append(this.currentView.render().el);
31 36 }
@@ -74,7 +79,7 @@ maintain a back-reference at `this.parent`. This is used to reach up and call
74 79
75 80 You'll need these, but chances are you already have them in your app:
76 81
77   -* jQuery
  82 +* jQuery or Zepto
78 83 * Underscore
79 84 * Backbone
80 85
@@ -131,7 +136,7 @@ First off:
131 136 In your `config/application.rb`:
132 137
133 138 ``` ruby
134   -config.middleware.use Rack::Static,
  139 +config.middleware.use Rack::Static,
135 140 :urls => ['/vendor/plugins/backbone-support/lib/assets/javascripts']
136 141 ```
137 142
@@ -157,7 +162,6 @@ end
157 162 Your individual specs will then need the full root path in `require`. For
158 163 example:
159 164
160   -
161 165 ``` js
162 166 requirePublic = function(path) {
163 167 require("/public/javascripts/" + path);
2  spec/javascripts/support/jasmine.yml
@@ -14,6 +14,8 @@ src_files:
14 14 - vendor/jquery.js
15 15 - vendor/underscore.js
16 16 - vendor/backbone.js
  17 + - lib/assets/javascripts/backbone-support.js
  18 + - lib/assets/javascripts/backbone-support/support.js
17 19 - lib/**/*.js
18 20
19 21 # spec_files

0 comments on commit 10b7234

Please sign in to comment.
Something went wrong with that request. Please try again.