Skip to content

Instantly share code, notes, and snippets.

@opichals
Created February 18, 2014 16:23
Show Gist options
  • Save opichals/9074197 to your computer and use it in GitHub Desktop.
Save opichals/9074197 to your computer and use it in GitHub Desktop.
ObjectProxy.unknownProperty definesProperty
var content = Em.Object.create({
x: 1,
y: 2,
z: 0
});
var op = Em.ObjectProxy.createWithMixins({
content: content,
yBinding: 'x',
_xDidChange: function() {
this.set('z', this.get('x'));
}.observes('x')
});
Em.run.sync();
alert(Em.inspect({content: Em.inspect(content.getProperties('x', 'y', 'z')), op: Em.inspect(op.getProperties('x', 'y', 'z'))}));
op.set('x', 3);
Em.run.sync();
// note the content.y not being propagated from the op
// caused by https://github.com/emberjs/ember.js/commit/8da6cb5d6a22687bb2409c43da582c95ab8e6744
//
alert(Em.inspect({content: Em.inspect(content.getProperties('x', 'y', 'z')), op: Em.inspect(op.getProperties('x', 'y', 'z'))}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment