Default options provided for when a new control is created without values set in options.
defaults provides default values for a Control's options.
Options passed into the constructor function will be shallowly merged
into the values from defaults in setup, and
the result will be stored in this.options.
New instances of a can.Control will create a shallow copy of the default
options. Be aware as shallow copies keep a reference to object types, such as
objects, maps and computes.
var Sample = can.Control.extend({
defaults: {
computedProp: can.compute(),
primitiveProp: 'sample'
}
}, {});
var a = new Sample('div');
var b = new Sample('li');
//`computedProp` will be shared across instances of the `Sample` control.
//a.options.computedProp === b.options.computedProp
Default options provided for when a new control is created without values set in
options
.defaults
provides default values for a Control's options. Options passed into the constructor function will be shallowly merged into the values from defaults in setup, and the result will be stored in this.options.Shared Properties
New instances of a can.Control will create a shallow copy of the default options. Be aware as shallow copies keep a reference to object types, such as objects, maps and computes.