Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sproutcore/sproutguides
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Feb 2, 2011
2 parents 3158547 + 904d3ee commit 5d116df
Show file tree
Hide file tree
Showing 4 changed files with 507 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,2 +1,4 @@
output
.DS_Store .DS_Store
.bundle
bin
output
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -12,7 +12,7 @@ In order to start generating documentation, complete the following steps:


- install the [SproutGuides package](http://guides-pkg.strobeapp.com/Guides.pkg) - install the [SproutGuides package](http://guides-pkg.strobeapp.com/Guides.pkg)
- clone SproutGuides from git://github.com/sproutcore/sproutguides.git - clone SproutGuides from git://github.com/sproutcore/sproutguides.git
- cd into sproutguides and run `guides generate` to generate the output directory - cd into sproutguides and run `guides build` to generate the output directory


Once you've completed these steps, you're ready to start working with Once you've completed these steps, you're ready to start working with
SproutGuides. You'll do your work inside the source/ directory. As you make SproutGuides. You'll do your work inside the source/ directory. As you make
Expand Down
27 changes: 26 additions & 1 deletion source/core_concepts.textile
Expand Up @@ -299,7 +299,7 @@ i.e. +this.notifyPropertyChange('value')+.
In some cases you may find that you are updating a number of properties at In some cases you may find that you are updating a number of properties at
once. If you have a lot of observers that depend on these properties, you once. If you have a lot of observers that depend on these properties, you
may find them getting called more often than necessary. In this case, you may find them getting called more often than necessary. In this case, you
can use +beingPropertyChanges+ and +endPropertyChanges+ to wrap the your can use +beginPropertyChanges+ and +endPropertyChanges+ to wrap the your
property change calls. This will cause all change notifications to happen property change calls. This will cause all change notifications to happen
once +endPropertyChanges+ is called and will prevent unnecssary duplicate once +endPropertyChanges+ is called and will prevent unnecssary duplicate
notifications. notifications.
Expand Down Expand Up @@ -401,6 +401,29 @@ instead. In this case the local property (where the binding is defined) will
be updated when the remote property changes, but changes to the local be updated when the remote property changes, but changes to the local
property will not propagate to the remote property. property will not propagate to the remote property.


h4. Bindings and Chained Property Paths

Since bindings make use of observers behind the scenes, the same principles
of chained observers applies. This means that if you want to observe a
chained property, you will want to use asterisks in your path as appropriate.

<javascript>
MyApp.usersController = SC.ArrayController.create({
mainUser: SC.Object.create({
name: 'Joe'
})
});

MyApp.userNameView = SC.LabelView.create({
valueBinding: 'MyApp.usersController*mainUser.name'
});
</javascript>

Since we used an asterisk in the +valueBinding+ property path, the binding
will be updated if either +mainUser+ or +mainUser.name+ changes.

h4. Bindings Shorthand

Since bindings are used so often, there's also a shortcut to creating Since bindings are used so often, there's also a shortcut to creating
bindings. All you need to do is append +Binding+ to the property name. bindings. All you need to do is append +Binding+ to the property name.
In the above example, you could instead do: In the above example, you could instead do:
Expand Down Expand Up @@ -451,3 +474,5 @@ h3. Changelog
* January 12, 2011: initial partial version by "Peter Wagenet":credits.html#pwagenet * January 12, 2011: initial partial version by "Peter Wagenet":credits.html#pwagenet
* January 19, 2011: further updates by "Peter Wagenet":credits.html#pwagenet * January 19, 2011: further updates by "Peter Wagenet":credits.html#pwagenet
* January 20, 2011: corrections to "The +init+ Method" and "The Run Loop" by "Peter Wagenet":credits.html#pwagenet * January 20, 2011: corrections to "The +init+ Method" and "The Run Loop" by "Peter Wagenet":credits.html#pwagenet
* January 24, 2011: added section on "Bindings and Chained Property Paths" by "Peter Wagenet":credits.html#pwagenet

0 comments on commit 5d116df

Please sign in to comment.