Skip to content

Instantly share code, notes, and snippets.

@hasdavidc
Created September 28, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasdavidc/eba3893d11983fb24cf3 to your computer and use it in GitHub Desktop.
Save hasdavidc/eba3893d11983fb24cf3 to your computer and use it in GitHub Desktop.
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