attr
Get or set properties on a SimpleMap.
    map.attr(key)
  
  Reads a property from this SimpleMap.
Parameters
- key {String}:The property to read. 
Returns
 {*}: 
The value assigned to key.
    map.attr(key, value)
  
  Assigns value to a property on this SimpleMap called key.
Parameters
- key {String}:The property to set. 
- value {*}:The value to assign to key. 
Returns
 {can.SimpleMap}: 
This SimpleMap, for chaining.
    map.attr(obj)
  
  Assigns each value in obj to a property on this SimpleMap named after the
corresponding key in obj, effectively merging obj into the SimpleMap.
Parameters
- obj {Object}:A collection of key-value pairs to set. If any properties already exist on the SimpleMap, they will be overwritten.
Returns
 {can.SimpleMap}: 
this SimpleMap, for chaining
Use
attr gets or sets properties on the SimpleMap it's called on. Here's a tour through how all of its forms work:
var map = new SimpleMap({ age: 29 });
// get a property:
foo.attr('age'); // 29
// set a property:
foo.attr('age', 30);
foo.attr('age'); // 30
// set and merge multiple properties:
foo.attr({
    first: 'Kevin',
    last: 'Phillips'
});
foo.attr('age'); // 30
foo.attr('first'); // 'Kevin'
foo.attr('last'); // 'Phillips'
When properties are changed using attr, the SimpleMap will emit events. Events can be listened to using [can-event.on] or [can-event.bind].
var map = new SimpleMap({ age: 29 });
map.on('age', function(ev, newVal, oldVal) {
    newVal; // 30
    oldVal; // 29
});
map.attr('age', 30);
 GitHub
GitHub Twitter
Twitter