DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
      • events
        • add
        • length
        • propertyName
        • remove
      • prototype
        • concat
        • filter
        • forEach
        • get
        • indexOf
        • join
        • map
        • on
        • pop
        • push
        • replace
        • reverse
        • serialize
        • set
        • shift
        • slice
        • sort
        • splice
        • unshift
        • *
        • #
      • static
        • extend
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-define/list/list
  • /
  • #
  • / On this page
    • #

      property

      Define default behavior for items in the list.

      • source

      PropDefinition

      By defining a wildcard property ("#") on the prototype, this will supply a default behavior for items in the list. The default wildcard ("#") definition makes every item run through the "observable" types converter. It looks like:

      "#": {
        type: "observable"
      }
      

      Setting the wildcard is useful when items should be converted to a particular type.

      var Person = DefineMap.extend({ ... });
      
      var People = DefineList.extend({
        "#": Person
      });
      

      The wildcard property has optional added and removed functions that will be called after an item is added or removed from the list with this being the list.

      var People = DefineList.extend({
        "#": {
          added: function(itemsAdded, index) { ... },
          removed: function(itemsRemoved, index) { ... }
        }
      });
      

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