Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : I wonder what exactly is can.compute?

$
0
0
Yes, if you are not live binding it does just act as a function. The difference is, that you can bind to changes on a can.compute and it works with Observes. Which means if you do something like:
  1. var fullName = can.compute(function () {
  2. return person.attr('firstName') + ' ' + person.attr('lastName');
  3. });
So if you do fullName.bind('change', function() {}); the change event will actually happen every time one of the attributes changes.
I think your understanding is correct I am just not entirely sure what exactly your question was.

Viewing all articles
Browse latest Browse all 3491

Trending Articles