Typescript Singleton
Mon Aug 15 2022 11:01:33 GMT+0000 (Coordinated Universal Time)
Saved by
@ale_figure8
class Singleton{
private static instance: Singleton; //Propiedad de la clase
public random:number; // Propiedad del objeto
private constructor(){
this.random = Math.random();
}
public static getInstance():Singleton{
if(!this.instance){
this.instance = new Singleton();
}
return this.instance;
}
}
content_copyCOPY
Comments