I've been seeing the syntax:
var module = {
func: function(value) {
some code;
}.func2("value");
}
cropping up in various places, as am wondering how this is done. I remember seeing an article about it a while back, but can't find it now. Whatever I try .func2("value")
just trows syntax errors.
For example, take a look at SproutCore's intro to their TemplateView.
Todos.StatsView = SC.TemplateView.extend({
remainingBinding: 'Todos.todoListController.remaining',
displayRemaining: function() {
var remaining = this.get('remaining');
return remaining + (remaining === 1 ? " item" : " items");
}.property('remaining').cacheable()
});
Seems like it would be a useful tool to give users when writing factories.
Thanks.