Is it possible to make a property dependent on all the properties of another object? For example: (also in jsfiddle):
html:
No, but it's really easy to write up an observer that watches everything and triggers your computed property to update anytime it updates. I'm not necessarily recommending this, but it can be done.
http://jsfiddle.net/5gS59/
App.Weapon = Ember.Object.extend({
damage: null,
speed: null,
version: 0,
watchingEverything: function(){
console.log('hello');
this.incrementProperty('version');
}.observes('damage','speed')
});
weaponDamagePerSecond: function() {
var weapon = this.get('activeWeapon');
console.log('weapon damage:' + weapon.get('damage'));
console.log('weapon speed:' + weapon.get('speed'));
console.log('strength:' + this.get('strength'));
console.log (weapon.get('damage') + this.get('strength')) * weapon.get('speed');
return (1.0 * weapon.get('damage') + 1.0 * this.get('strength')) * weapon.get('speed');
}.property('activeWeapon.version', 'strength')
You can alternately do a similar thing with just a property and not an observes:
http://jsfiddle.net/XsuxA/1/