AttributeExtras.js revision d2fe481f82326b03c9a545af61f3379ac5d7fef1
/**
* The attribute module provides an augmentable Attribute implementation, which
* adds configurable attributes and attribute change events to the class being
* augmented. It also provides a State class, which is used internally by Attribute,
* store state.
*
* @module attribute
*/
/**
* The attribute-extras submodule provides less commonly used attribute methods, and can
*
* @module attribute
* @submodule attribute-extras
*/
var BROADCAST = "broadcast",
PUBLISHED = "published",
INIT_VALUE = "initValue",
MODIFIABLE = {
readOnly:1,
writeOnce:1,
getter:1,
};
/**
* A augmentable implementation for AttributeCore, providing less frequently used
* methods for Attribute management such as modifyAttrs(), removeAttr and reset()
*
* @class AttributeExtras
*/
function AttributeExtras() {}
/**
* Updates the configuration of an attribute which has already been added.
* <p>
* The properties which can be modified through this interface are limited
* to the following subset of attributes, which can be safely modified
* after a value has already been set on the attribute: readOnly, writeOnce,
* broadcast and getter.
* </p>
* @method modifyAttr
* @param {String} name The name of the attribute whose configuration is to be updated.
* @param {Object} config An object with configuration property/value pairs, specifying the configuration properties to modify.
*/
var host = this, // help compression
}
// If we reconfigured broadcast, need to republish
}
}
}
}
if (!host.attrAdded(name)) {Y.log('Attribute modifyAttr:' + name + ' has not been added. Use addAttr to add the attribute', 'warn', 'attribute');}
},
/**
* Removes an attribute from the host object
*
* @method removeAttr
* @param {String} name The name of the attribute to be removed.
*/
removeAttr: function(name) {
},
/**
* Resets the attribute (or all attributes) to its initial value, as long as
* the attribute is not readOnly, or writeOnce.
*
* @method reset
* @param {String} name Optional. The name of the attribute to reset. If omitted, all attributes are reset.
* @return {Object} A reference to the host object.
* @chainable
*/
var host = this; // help compression
if (name) {
}
} else {
});
}
return host;
},
/**
* Returns an object with the configuration properties (and value)
* for the given attribute. If attrName is not provided, returns the
* configuration properties for all attributes.
*
* @method _getAttrCfg
* @protected
* @param {String} name Optional. The attribute name. If not provided, the method will return the configuration for all attributes.
* @return {Object} The configuration properties for the given attribute, or all attributes.
*/
_getAttrCfg : function(name) {
var o,
if (name) {
} else {
o = {};
});
}
return o;
}
};