Adds a warning in debug mode when duplicate bindings for the same key ar... #820

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant
Owner

publickeating commented Aug 30, 2012

...e detected. This warning detects when a binding is being created more than once for the same property.

For example, if you define 'smallBinding' like so:

MyApp.ParentClass = SC.View.extend({ 
  smallBinding: … 
})

and then extend MyApp.ParentClass further like so:

// ...
childViews: ['childView1'],

childView1: MyApp.ParentClass.extend({ 

  smallBinding: …  

// …

then childView1 would have the binding to small appearing twice in its bindings Array. It appears to actually be the same instance of the Binding that appears twice. This can lead to strange behaviour when you try to connect and disconnect the bindings on the fly. I haven't explored it, but maybe it's a memory leak also.

In any case, this warning is meant to inform developers when they are doing something strange like this.

Adds a warning in debug mode when duplicate bindings for the same key…
… are detected. This warning detects when a binding is being created more than once for the same property.

For example, if you define 'smallBinding' inside 'MyApp.ParentClass = SC.View.extend({ smallBinding: … ' and then extend MyApp.ParentClass further like so 'childView1: MyApp.ParentClass.extend({ smallBinding: …  ', then childView1 would have the same binding to small appearing twice in its bindings Array.  This can lead to strange behaviour when you try connect and disconnect the bindings on the fly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment