DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
  • Infrastructure
  • Legacy
    • can-ejs
    • can-list
      • Prototype
        • attr
        • each
        • filter
        • map
        • reverse
        • splice
      • Static
        • Map
        • extend
    • can-map
    • can-map-backup
    • can-map-define
    • can-view-href
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Legacy
  • /
  • can-list
  • /
  • Map
  • / On this page
    • Map

      property

      Specify the Map type used to make objects added to this list observable.

      • source

      can-map

      When objects are added to a List, those objects are converted into can.Map instances. For example:

       var list = new List();
       list.push({name: "Justin"});
      
       var map = list.attr(0);
       map.attr("name") //-> "Justin"
      

      By changing Map, you can specify a different type of Map instance to create. For example:

       var User = Map.extend({
         fullName: function(){
           return this.attr("first")+" "+this.attr("last")
         }
       });
      
       User.List = List.extend({
         Map: User
       }, {});
      
       var list = new User.List();
       list.push({first: "Justin", last: "Meyer"});
      
       var user = list.attr(0);
       user.fullName() //-> "Justin Meyer"
      

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.