Skip to content

Instantly share code, notes, and snippets.

@gajus gajus/wm.js

Last active Mar 12, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.