I\'ve been going through the Ember documentation and am seeing an inconsistency in where the _super
method is being called when overriding init
.
In the documentation linked
init: function() {
var childViews = this.get('childViews');
var descriptionView = App.DescriptionView.create();
childViews.pushObject(descriptionView);
this.addButton();
return this._super();
},
_super()
is called AFTER the descriptionView is created and pushed onto the childViews
array.
That's because the superclass init
implementation is going to take the childViews array and do stuff with it. If you called _super
before adding the descriptionView
to the array, it wouldn't get processed by whatever init
does....
I'm inferring, but that's the way it works in Sproutcore, from which Ember derives, so I think it's probably the same.