6/8/2016 - 6:23 PM


can.DefineMap.extend([name,] [static,] prototype)

Extends can.DefineMap, or constructor functions derived from can.DefineMap, to create a new constructor function.

var Person = can.DefineMap.extend(
  {seal: true},
    first: "string",
    last: "string",
    fullName: {
      get: function(){
        return this.first+" "+this.last;
  • name {String}: Provides an optional name for this type that will show up nicely in debuggers.

  • static {Object}: Static properties that are set directly on the constructor function.

  • prototype {Object<String,can-define-map.propDefinition>}: A definition of the properties or methods on this type.

  • {can-define-map}: A DefineMap constructor function.

new can.DefineMap([props])

Creates a new instance of DefineMap or an extended DefineMap.

var person = new can.DefineMap({
  first: "Justin",
  last: "Meyer"
  • props {Object}: Properties and values to seed the map with.
  • {can-define-map}: An instance of can.DefineMap with the properties from props.

map.each( callback(item, propName ) )

each iterates through the Map, calling a function for each property value and key.

  • callback {function(item, propName)}: the function to call for each property The value and key of each property will be passed as the first and second arguments, respectively, to the callback. If the callback returns false, the loop will stop.
  • {can.Map}: this Map, for chaining