Last active
March 12, 2018 14:44
-
-
Save gajus/5d183b3cf7bf775a03e9 to your computer and use it in GitHub Desktop.
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
let doFoo = new WeakMap(), | |
doBar = new WeakMap(); | |
class Foo { | |
constructor () { | |
doFoo.set(this, () => { | |
// definition of doFoo for the instance of Foo. | |
}); | |
doBar.set(this, () => { | |
// definition of doBar for the instance of Foo. | |
}); | |
} | |
publicMethodThatUsesFoo () { | |
doFoo.get(this)(); // call doFoo | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment