Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SingletonPattern {
- private static instance: SingletonPattern
- static getInstance() {
- if (!SingletonPattern.instance) {
- SingletonPattern.instance = new SingletonPattern()
- }
- return SingletonPattern.instance
- }
- private constructor() { }
- private propOne = 1
- private propTwo = 1
- methodOne() {
- return this.propOne
- }
- methodTwo() {
- return this.propTwo
- }
- }
- export default SingletonPattern.getInstance()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement