Creating properties/bindings on the fly


#1

I don’t fully understand the bindings API and what it can do. I’m looking at how Addepar’s StyleBindingsMixin sets up bindings on init, but is it possible to override the unknownProperty function of an observable, and add new properties when they are first requested, while allowing the requester to bind immediately to the new property for any updates?

E.g. in a controller definition,

needs: ['dynamicProperties'],
myPropBinding: 'controllers.dynamicProperties.someNewProperty'

whereby myProp will be bound to a newly generated someNewProperty in the other controller.

I’ve been fiddling. If I can get this to work as expected, it opens some exciting possibilities.

Thanks to your expert eyes!


How can I set a dynamic binding?
#2

Further fiddling and I answered my own question. It works. A new property can be defined within unknownProperty and bindings/observers will track changes: http://jsbin.com/fehayaza/50/edit

Cooooool