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

Re : can.Observe.setter vs. .bind( 'change', . . .

$
0
0
A setter is invoked before the Observe is changed. This allows you to modify the raw value being set for a particular attribute. For advanced use cases, you can modify other attributes of the Observe based on what the new value is.

There's no clean way of doing this using .bind, because you have to use .attr() to change the values of the Observe which fires a change event, which modifies the Observe which fires a change event, etc, etc. You'd have to add some messy logic into the event handler to prevent an infinite loop.

What use case are you evaluating setter for?

Viewing all articles
Browse latest Browse all 3491

Trending Articles