Skip to content

Commit

Permalink
add docs regarding observers and computed properties (ref emberjs#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam McCrea committed May 3, 2012
1 parent 00b8940 commit 0e78221
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ember-runtime/lib/ext/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ if (Ember.EXTEND_PROTOTYPES) {
});
Make sure you list these dependencies so Ember.js knows when to update
bindings that connect to a computed property.
bindings that connect to a computed property. Changing a dependency
will not immediately trigger an update of the computed property, but
will instead clear the cache so that it is updated when the next `get`
is called on the property.
Note: you will usually want to use `property(...)` with `cacheable()`.
Expand Down
5 changes: 5 additions & 0 deletions packages/ember-runtime/lib/mixins/observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ var get = Ember.get, set = Ember.set;
This will call the `targetAction` method on the `targetObject` to be called
whenever the value of the `propertyKey` changes.
Note that if `propertyKey` is a computed property, the observer will be
called when any of the property dependencies are changed, even if the
resulting value of the computed property is unchanged. This is necessary
because computed properties are not computed until `get` is called.
@extends Ember.Mixin
*/
Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
Expand Down

0 comments on commit 0e78221

Please sign in to comment.