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

Re : how to add functions on can.Map

$
0
0
When defined like that, speak isn't a property, it's a function.  Properties are things that you change.  Typically, you call functions and they are permanent behaviors of some object.

If you want a function whose result is retrieved via .attr, use the define plugin like:

can.Map.extend({
  define: {
    fullName: {
       get: function(){
         return this.attr("first")+" "+this.attr("last")
       }
    }
  }
})

Viewing all articles
Browse latest Browse all 3491

Trending Articles