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
  • /
  • extend
  • / On this page
    • extend

      function
      • source

      List.extend([name,] [staticProperties,] instanceProperties)

      Creates a new extended constructor function. Learn more at [can.Construct.extend].

      var MyList = List.extend({}, {
          // silly unnecessary method
          count: function(){
              return this.attr('length');
          }
      });
      
      var list = new MyList([{}, {}]);
      console.log(list.count()); // -> 2
      

      Parameters

      1. name {String}:

        If provided, adds the extened List constructor function to the window at the given name.

      2. staticProperties {Object}:

        Properties and methods directly on the constructor function. The most common property to set is Map.

      3. instanceProperties {Object}:

        Properties and methods on instances of this list type.

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