Created
April 19, 2010 21:20
-
-
Save sergi/371650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Class1 = function() { | |
Class1.superclass.constructor.call(this, config); | |
} | |
Class1.NAME = "class1"; | |
Class1.ATTRS = { | |
//Several Attributes here | |
} | |
Y.extend(Class1, Y.Base, { | |
// Several prototype methods here | |
} | |
// I want to inherit from Class1 and also get its Attributes | |
var Class2 = function(config) { | |
Class2.superclass.constructor.apply(this,arguments); | |
var attrs = { | |
width: {}, | |
height: {} | |
}; | |
this.addAttrs(attrs, config); | |
} | |
Y.mix(Class2, { | |
NAME: "class2", | |
ATTRS: Class1.ATTRS | |
}); | |
Y.extend(Class2, Class1, { | |
// Class 2 prototype methods here... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changing Class2 to...
var Class2 = function(config) {
Class2.superclass.constructor.apply(this, arguments);
};
Y.mix(Class2, {
NAME: "class2",
ATTRS: {
width: {...},
height: {...}
}
});
Y.extend(Class2, Class2, {
});