Skip to content

Latest commit

 

History

History

singleton

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

TypeScript design patterns - singleton

In this project, you can find 2 examples of the singleton pattern. Example 1 is pretty simple, it helps you to understand the basics of this pattern. However example 2 is more like a real-life usage of the singleton pattern.

Read more on Medium

Installation

npm i

Example 1 - Simple

Start

npm run start:simple

Files

You can find the entry point at src/simple.ts and the rest of the necessary files under src/simple

Example 2 - Singleton pattern in Cache

Start

npm start

Files

You can find the entry point at src/main.ts. The other necessary files are in the rest of the directories, but src/simple.