I want to access the class used to create an object instance from EmberJS. For example, given an an instance of the MyWidgetClass in the below example, I’d like to access the myProperty attribute of the class.
MyWidgetClass = Ember.View.Extend({});
MyWidgetClass.reopenClass({
myProperty: 'hihihi'
});
console.log("The myProperty of MyWidgetClass is ", MyWidgetClass.myProperty);
myWidget = MyWidgetClass.create({});
console.log("The myProperty of the Class of myWidget is ",
myWidget.WHAT_GOES_HERE.myProperty);
I want to know what to put in WHAT_GOES_HERE on the last line of code. I’ve tried myWidget._super, myWidget.proto, etc.
You can use the
constructorproperty. Here’s a jsFiddle: http://jsfiddle.net/7eJ79/