/** * 基类、单例 */ export default class Provider { private static instance; private static readonly pool = {}; constructor() { } public static getInstance(this: T): InstanceType { // return this.instance ||= new this(); if (!this.instance) { this.instance = new this(); Provider.pool[this.name] = this.instance; } return this.instance; } public static getPool() { return { pool: Provider.pool, } } }