Created
September 28, 2015 23:08
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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