webcad-ue4-api/types/Common/Singleton.d.ts

21 lines
715 B
TypeScript
Raw Normal View History

2023-07-06 10:23:55 +08:00
export interface PrototypeType<T> extends Function {
prototype: T;
}
export interface ConstructorFunctionType<T = any> extends PrototypeType<T> {
new (...args: any[]): T;
}
export type ConstructorType<T = unknown, Static extends Record<string, any> = PrototypeType<T>> = (ConstructorFunctionType<T> | PrototypeType<T>) & {
[Key in keyof Static]: Static[Key];
};
2021-01-28 10:17:21 +08:00
/**
* .
* # Example:
* class A extends Singleton(){};
* //获得单例
* let a = A.GetInstance();
*/
export declare class Singleton {
protected constructor();
2023-07-06 10:23:55 +08:00
static GetInstance<T extends Singleton>(this: ConstructorType<T, typeof Singleton>): T;
2021-01-28 10:17:21 +08:00
}
//# sourceMappingURL=Singleton.d.ts.map