Skip to content
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

Mixin calling its own thing instead of super's thing #24

Open
bcowgill opened this issue Feb 4, 2015 · 0 comments
Open

Mixin calling its own thing instead of super's thing #24

bcowgill opened this issue Feb 4, 2015 · 0 comments

Comments

@bcowgill
Copy link

bcowgill commented Feb 4, 2015

I was looking at how the mixin code works. In the test case paraphrased below, If I wanted to implement a mixin where I called the Sub-class's thing before the implemented thing, how do you do that? Calling this.thing directly will just give an infinite loop.

test('should implement a wrapper method for mixins', 5, function () {
...
inst.implement({
thing: function (n) {
console.log('Implement#thing()');
ok(true, 'called implementer');
//this.supr(); would be called by subclass' thing, if we could
this.thing(); // WARNING infinite loop. want to call the Sub's thing, not the base thing
// this.myself(); would be a good expression for that
this.boooshr();
},
boooshr: function () {
console.log('Implement#boooshr()');
ok(true, 'called boooshr');
}
}).thing();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant