const modelRefMap = new WeakMap ( ) ; export class ModelRef < T > { obj : T ; private constructor ( obj ) { this . obj = obj ; } public getModel ( ) { return this . obj ; } public static getRef < T > ( obj ) { if ( modelRefMap . has ( obj ) ) { return modelRefMap . get ( obj ) ; } const ref = new ModelRef < T > ( obj ) ; modelRefMap . set ( obj , ref ) ; return ref ; } }