Created
February 27, 2018 23:57
-
-
Save brandonvanha/1c7526b70466ecb8b53544edcb89314a to your computer and use it in GitHub Desktop.
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
class MyClass | |
{ | |
private static _instance: MyClass; | |
private constructor() | |
{ | |
//... | |
} | |
public static get Instance() | |
{ | |
// Do you need arguments? Make it a regular method instead. | |
return this._instance || (this._instance = new this()); | |
} | |
} | |
const myClassInstance = MyClass.Instance; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment