/** * 单例基类 */ export class Singleton { constructor() {} /**获取单例实例 * @returns 单例实例 */ public static ins(this: new () => T): T { if (!(this)._ins) { ;(this)._ins = new this() } return (this)._ins } /** * 销毁单例实例 */ public static destroy(this: new () => T): void { ;(this)._ins = null } }