Can you explain why in this fiddle (can.Component with can.compute in scope and compute change event handler)
after attr1 is set to value 1 can.compute "comp" is called 3 times not just one?
- can.Component({
- tag: 'test-comp',
- scope: {
- init: function(){
- console.log('test-comp init')
- },
- comp: can.compute(function(){
- var attr1 = this.attr('attr1'),
- attr2 = this.attr('attr2')
- console.log('comp attr1 attr2', attr1, attr2)
- return null
- })
- },
- events: {
- '{scope} comp': function(){
- }
- }
- })
- $('body').append(can.view.mustache('<test-comp/>')())
- setTimeout(function(){
- $('test-comp').scope().attr('attr1', 1)
- })