I noticed in the canjs doc's linked to below that the can.Component examples frequently use functions in place of where can.Computes would suffice. Is there any advantage either way here? Within the view layer, wouldn't page be converted into a compute regardless, making it less efficient than had it been a compute within the prototype?
var CustomMap = can.Map.extend({
offset: 0,
limit: 20,
page: function(){
return Math.floor(this.attr('offset') / this.attr('limit')) + 1;
},
computedPage: can.compute(function() {
- return Math.floor(this.attr('offset') / this.attr('limit')) + 1;
})
})