-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow calling this._super in subclasses of CoreObject. #1721
Conversation
@rwjblue This is nice and lightweight and gets the job done. 👍 Let me know if you're interested in a solution that allows calls to |
8eaea6c
to
f4d1907
Compare
Updated to include a super wrapper (basically the same implementation as Ember), with a few tweaks. I attempted to make this conceptually similar to |
df7952c
to
f7f638b
Compare
@rwjblue failed |
f7f638b
to
76a0b37
Compare
I'm not exactly sure what the deal here is. It is only failing under node 0.11... |
fb6b449
to
9db1817
Compare
Tracked down the issue in node 0.11: Apparently, setting |
92c5aa7
to
e16d1de
Compare
Updated to ensure we do not wrap methods that do not call _super. |
I really dislike ember's super, can we just do it manually like: this._super$foo(..) https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/map.js#L350 its ugly but "just works" |
My initial implementation actually, just made Will revert to that implementation (which was really just a single line change IIRC). |
* Add a few tests for `CoreObject`. * Allow calling methods on your parent class via `this._super.someMethod()`. Illustration: ```javascript var fooCalled, barCalled, instance; var Klass1 = CoreObject.extend({ foo: function() { fooCalled = true; } }); var Klass2 = Klass1.extend({ foo: function() { this._super.foo(); }, bar: function() { barCalled = true; this._super.foo(); } }); instance = new Klass2(); instance.bar(); assert(fooCalled, 'foo called'); assert(barCalled, 'bar called'); fooCalled = false; instance.foo(); assert(fooCalled, 'foo called'); ```
e16d1de
to
c94a805
Compare
Moved back to super simple |
Allow calling this._super in subclasses of CoreObject.
CoreObject
.this._super.someMethod()
.Illustration: