Skip to content

Commit dbf1ba2

Browse files
committed
Updated comments
1 parent fab9577 commit dbf1ba2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
Special thanks to [Derick Bailey](http://lostechies.com/derickbailey) for creating predecessor to this plugin.
22
I've been able to reuse unit tests he created for his [Backbone.ModelBinding](https://github.com/derickbailey/backbone.modelbinding) plugin.
33

4-
### Availability
5-
You can download the zip/tarball as normal and include it with your other JS assets, but you can now alternatively link to it on [CDNJS](http://www.cdnjs.com/), the free to use, community maintained CDN.
6-
7-
To do this, just drop a reference to the minified version of the plugin into your document's `<head>` as follows, replacing the version number with whatever the latest one is:
8-
````
9-
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.modelbinder/0.1.3/Backbone.ModelBinder-min.js"></script>
10-
````
114

125
### Rationale
136
Backbone is a great platform for writing client side applications but I've found that as views grow in complexity, synchronizing my models and views can be a pain.
147
I've spent the past few months trying to use existing view-model binding libraries that others were kind enough to create and share with the world.
158
Unfortunately in the majority of my backbone application I wasn't able to leverage the existing view-model binding libraries due to various limitations.
169

1710
I created a new `Backbone.ModelBinder` class that I have leveraged in the majority of a large client side application.
18-
The ModelBinder class helped me remove a lot of cluttered boilerplate code that existed to synchronize my models and views. Hopefully you'll find it useful too.
11+
The ModelBinder class helped me remove a lot of cluttered boilerplate code that existed to synchronize my models and views.
12+
As my application became more asynchronous, the ModelBinder saves me from a lot of pain by automatically displaying model attributes in the view as they are asynchronously loaded.
13+
Hopefully you'll find the ModelBinder useful too.
1914

2015
The `Backbone.ModelBinder` class:
2116

@@ -43,13 +38,13 @@ SomeView = Backbone.View.extend({
4338
},
4439
4540
render: function() {
46-
$(this.el).html(this.template(this.model.toJSON()));
41+
this.$el.html(this.template(this.model.toJSON()));
4742
return this;
4843
}
4944
});
5045
````
5146

52-
While the style above technically works just fine it can be more efficient - especially for larger client applications that are not frequently refreshed.
47+
While the style above technically works just fine it can be more efficient by using the ModelBinder - especially for larger client applications that are not frequently refreshed.
5348

5449
If render is called multiple times, the previously created html elements are just thrown away.
5550
Converting the model to json is also an unnecessary conversion.
@@ -64,6 +59,17 @@ The ModelBinder eliminates both of these inefficiencies.
6459

6560
<br>
6661
I've posted some [examples](https://github.com/theironcook/Backbone.ModelBinder/wiki/Examples) of how to use the ModelBinder but I'd recommend reading the docs first.
62+
The examples don't show best practices but just show how you can make things work with the ModelBinder.
63+
64+
<br>
65+
### Availability
66+
You can download the zip/tarball as normal and include it with your other JS assets, but you can now alternatively link to it on [CDNJS](http://www.cdnjs.com/), the free to use, community maintained CDN.
67+
68+
To do this, just drop a reference to the minified version of the plugin into your document's `<head>` as follows, replacing the version number with whatever the latest one is:
69+
````
70+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.modelbinder/0.1.3/Backbone.ModelBinder-min.js"></script>
71+
````
72+
6773

6874
<br>
6975
##Defining Binding Scope with jQuery##

0 commit comments

Comments
 (0)