[add] slot1

This commit is contained in:
2024-08-26 16:44:51 +08:00
parent cad4bb3b56
commit 1d0ad3fd99
53 changed files with 3299 additions and 77 deletions

View File

@@ -0,0 +1,28 @@
/**
* 單例基類
* @example
* export default class Test extends BaseSigleton<Test>() { ...... }
* Test.Instance.Init();
*/
// tslint:disable-next-line:typedef
export default function BaseSingletonV2<T>() {
class BaseSingleton {
protected constructor() { }
public static _instance: BaseSingleton = null;
public static get Instance(): T {
if ((<any>this)._instance == null) {
(<any>this)._instance = new (<any>this)();
}
return (<any>this)._instance;
}
/** 初始化 */
public Init(): void { /** */ }
/** 銷毀 */
public Disp(): void {
(<any>this)._instance = null;
}
}
return BaseSingleton;
}