DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • prototype
    • concat
    • forEach
    • indexOf
    • join
    • pop
    • push
    • replace
    • reverse
    • shift
    • slice
    • splice
    • unshift
  • static
    • can.List.Map
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • can.List
  • /
  • can.List.Map
  • / On this page
    • can.List.Map

      property

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

      • source

      can.Map

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

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

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

      var User = can.Map.extend({
        fullName: function(){
          return this.attr("first")+" "+this.attr("last")
        }
      });
      
      User.List = can.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.