Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docs regarding observers and computed properties (ref #774) #780

Merged
merged 1 commit into from
May 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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