I am trying to figure out how to use this._super when an Ember object method is called from a callback.
I know that I could assign var _super = this._super before calling callback, but I don't like this.
I want to have this object containing the correct _super method inside the callback.
My code is here: http://emberjs.jsbin.com/hasehija/6/edit .
App.BaseMixin = Ember.Mixin.create({ init: function() { console.log("base"); } }); App.Utils = Ember.Object.extend({ callbackMethod: function(callback, ctx) { // asynchronous callback Ember.run(function() { callback.call(ctx); }); } }); App.MyObject = Ember.Object.extend(App.BaseMixin, { init: function() { console.log("MyObject"); var _super = this._super; App.Utils.create().callbackMethod(function() { this._super(); // this._super is undefined here // _super() would work }, this); } }); App.ApplicationController = Ember.Controller.extend({ init: function() { new App.MyObject(); } });
Do you know how to fix this?
UPDATE:
It turned out that it was fixed in Ember 1.5.0 (@GJK: thanks for the answer), and I used Ember 1.4.0.
source share