Skip to content

Instantly share code, notes, and snippets.

@sergi
Created April 19, 2010 21:20
Show Gist options
  • Save sergi/371650 to your computer and use it in GitHub Desktop.
Save sergi/371650 to your computer and use it in GitHub Desktop.
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...
});
@sdesai
Copy link

sdesai commented Apr 19, 2010

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, {
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment