Skip to content

Instantly share code, notes, and snippets.

@dwt
Forked from mauritslamers/gist:753075
Created December 23, 2010 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dwt/753093 to your computer and use it in GitHub Desktop.
Save dwt/753093 to your computer and use it in GitHub Desktop.
Arrayobservers = SC.Application.create({
NAMESPACE: 'Arrayobservers',
VERSION: '0.1.0',
store: SC.Store.create().from(SC.Record.fixtures)
});
Arrayobservers.objects = [SC.Object.create({foo: 1}), SC.Object.create({foo: 2})];
Arrayobservers.objectsController = SC.ArrayController.create();
Arrayobservers.contentNotifyingObjects = SC.Controller.create({
objectsBinding: SC.Binding.oneWay('Arrayobservers.objectsController*content'),
// or perhaps this instead of the other one.
//objectsBinding: SC.Binding.oneWay('Arrayobservers*objectsController),
computedProperty: function() {
console.log('computedProperty', this.get('objects').getEach('foo').get('@sum'));
}.property('objects')
});
SC.RunLoop.begin();
console.log('should now see computed property output twice');
Arrayobservers.setPath('objectsController.content', Arrayobservers.objects);
Arrayobservers.setPath('objects.1.foo', 5); // don't know what you are actually doing
SC.RunLoop.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment