Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
I don't think I'm doing anything blatantly wrong, but after memoization kicks in, subsequent calls to the child class's method end up skipping to the parent
import { autobind } from 'lib/decorators';
class AwesomeClass {
@autobind
awesomeMethod() {
console.log('parent called, AWESOME METHOD');
}
}
class AwesomeChildClass extends AwesomeClass {
@autobind
awesomeMethod() {
console.log('child called, AWESOME CHILD METHOD');
super.awesomeMethod();
}
}
let instance = new AwesomeChildClass();
for (var i = 0; i < 5; ++i) {
console.log('invoking');
instance.awesomeMethod();
console.log('---');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment