Skip to content

Instantly share code, notes, and snippets.

YUI.add('root-cls', function (Y) {
Y.Base._buildCfg.aggregates.push('getClassAttrs');
Y.rootClass = Y.Base.create('root-class', Y.Base, [], {
someInstanceMethod : function () {}
}, {
ATTRS : {
test : {
validator : Y.Lang.isBoolean
}
// The idea behind ATTRS, is that Base will take care of
// setting up the attributes defined in ATTRS for each
// subclass. So, you don't need to do anything special
// for Class2's ATTRS definition.
// Changing Class2 to this should take care of it.
var Class2 = function(config) {
Class2.superclass.constructor.apply(this, arguments);
};