
Flyweight Use Case : Design Patterns in TypeScript
Design Patterns In TypeScript (book)
https://www.amazon.com/dp/B0948BCH24 : ASIN B0948BCH24
https://www.amazon.com/dp/B094716FD6 : ASIN B094716FD6
Documentation : https://sbcode.net/typescript/flyweight/#flyweight-use-case
In this example, I create a dynamic table with 3 rows and 3 columns each. The columns are then filled with some kind of text, and also chosen to be left, right or centre aligned.
The letters are the flyweights and only a code indicating the letter is stored. The letters and numbers are shared many times.
The column cells are the contexts and they pass the extrinsic vales describing the combination of letters, the justification left, right or centre, and the width of the table column that is then used for the space padding.
#flyweightPattern
#typescriptFlyweight
#flyweightPatternTypescript