2022-11-27 23:23:47 +08:00
|
|
|
export default class Singleton {
|
2022-12-08 21:14:02 +08:00
|
|
|
private static _instance: any = null;
|
2022-11-27 23:23:47 +08:00
|
|
|
|
|
|
|
static GetInstance<T>(): T {
|
|
|
|
if (this._instance === null) {
|
2022-12-08 21:14:02 +08:00
|
|
|
this._instance = new this();
|
2022-11-27 23:23:47 +08:00
|
|
|
}
|
2022-12-08 21:14:02 +08:00
|
|
|
return this._instance;
|
2022-11-27 23:23:47 +08:00
|
|
|
}
|
|
|
|
|
2022-12-08 21:14:02 +08:00
|
|
|
protected constructor() {}
|
|
|
|
}
|