Binding on .length of an object #142

Closed
justinbmeyer opened this Issue Nov 6, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@justinbmeyer
Contributor

justinbmeyer commented Nov 6, 2012

If I have a compute like:

var obs = new can.Observe();
var compute = can.compute(function(){
  var txt = "';
  obs.each(function(val){
    txt+= val
  });
  return txt;
})

It should produce change events when I add or remove properties to obs.

@dispatchrabbi

This comment has been minimized.

Show comment
Hide comment
@dispatchrabbi

dispatchrabbi Nov 6, 2012

Contributor

Here's what I think is happening here: compute keeps an eye out for when .attr() is called on an observable in its value function, but it's not recognizing when .each() is called (probably because .each() calls .attr() on different things each time). More later, hopefully after fixing.

Contributor

dispatchrabbi commented Nov 6, 2012

Here's what I think is happening here: compute keeps an eye out for when .attr() is called on an observable in its value function, but it's not recognizing when .each() is called (probably because .each() calls .attr() on different things each time). More later, hopefully after fixing.

@imjoshdean imjoshdean closed this in 8245f1a Nov 6, 2012

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Nov 14, 2012

Contributor

This works now by using can.Observe.keys( observe ) -> [key1, key2].

When you call the keys function, it indicates that you are reading from a special __keys property. When you add or remove properties to the observe, a __keys event is triggered.

__keys is now a reserved property on can.Observes.

Contributor

justinbmeyer commented Nov 14, 2012

This works now by using can.Observe.keys( observe ) -> [key1, key2].

When you call the keys function, it indicates that you are reading from a special __keys property. When you add or remove properties to the observe, a __keys event is triggered.

__keys is now a reserved property on can.Observes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment