Say I’m sub-classing (“extending”) Ember.View to create My.Widget. I’d like each My.Widget sub-class to have a ‘class attribute’ called ‘XMLTag’ that can be used for de-serializing from an XML document.
My.Widget = Ember.View.extend( { /*...*/ });
My.MySubWidget = My.Widget.extend( { /*...*/ });
My.MySubWidget.XMLTag = 'MySubWidget';
Is this the right way to go about this? Or is there some sort of trick I can use in “extend()” to specify that its a class attribute?
The proper way to extend class level variables or methods is reopenClass(), e.g.:
Simply adding the property to My.SubWidget will not be retained if you further extend the class.