-
-
Save L8D/62c301567f1f885e01ba 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 wm = new WeakMap(); | |
class Foo { | |
constructor () { | |
var privateData = {}; | |
wm.set(this, privateData); | |
privateData.myProperty = 1; | |
} | |
getMyProperty() { | |
var privateData = wm.get(this); | |
return privateData.myProperty; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment