Zordius![]()
Description
This module provides 5 more methods for Attribute:
Note
1 Y.mix(Y.Base.prototype, Y.zui.Attribute.prototype, true);
2 Y.mix(Y.AttributeCore.prototype, Y.zui.Attribute.prototype, true); then Y.use('base', ...);
Known Issue
<script src="http://yui.yahooapis.com/3.8.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2013.02.07-15-27'
}).use('gallery-zui-attribute', function(Y) {
// Add ZUI attribute support to one instance
Y.mix(myInstance, Y.zui.Attribute.prototype);
// enable revert() on 'testAttr2'
myInstance._revertList = {testAttr2: true};
// Or, enable revert() on all attributes
myInstance._doRevert = true;
// Now, set an attribute
myInstance.set('testAttr', 3);
// And you can revert the attribute
myInstance.revert('testAttr');
// Sync an attribute from another object
// Everytime objterObject.get('testAttr') changed, set() the value to myInstance
myInstance.sync('testAttr', otherObject);
// Sync an attribute from another object, specify a different attribute name
// Everytime objterObject.get('Attr2') changed, set() the value to myInstance
myInstance.sync('testAttr', otherObject, 'Attr2');
// Stop to monitering the attribute change
myInstance.unsync('testAttr', otherObject);
// Or, add ZUI attribute support to a class (before creating any instance)
Y.mix(myClass.prototype, Y.zui.Attribute.prototype);
// Now, all myClass instances support revert(), toggle(), etc ...
var testInstance = new myClass();
testInstance.toggle('testAttr');
// Add ZUI attribute support for all Attribute object
Y.mix(Y.Attribute.prototype, Y.zui.Attribute.prototype, true);
// Add ZUI attribute support for all Base object
Y.mix(Y.Base.prototype, Y.zui.Attribute.prototype, true);
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info