Created
October 4, 2015 14:58
-
-
Save thmsobrmlr/e9bf8cd17a01aa2e0f3e to your computer and use it in GitHub Desktop.
ES6 Singleton
This file contains 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 instance = null; | |
class MySingleton { | |
constructor() { | |
if(!instance){ | |
instance = this; | |
} | |
return instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment