System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, Instance, Singleton, _crd; _export({ default: void 0, Singleton: void 0 }); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "f298auxhOZIcJjqKwn1kGP+", "Instance", undefined); /**单例 * 加方法型 * public static getInstance(): XXX{ return Instance.get(XXX); } */ _export("default", Instance = class Instance { static get(clazz) { for (var _len = arguments.length, param = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { param[_key - 1] = arguments[_key]; } if (clazz["__Instance__"] == null) { clazz["__Instance__"] = new clazz(...param); } return clazz["__Instance__"]; } }); /**单例 * 继承型,静止实例化 */ _export("Singleton", Singleton = class Singleton { /** * 获取实例 */ static getInstance() { var _class = this; if (!_class._instance) { _class._instantiateByGetInstance = true; _class._instance = new _class(); _class._instantiateByGetInstance = false; } return _class._instance; } /** * 构造函数 * @protected */ constructor() { if (!this.constructor._instantiateByGetInstance) { throw new Error("Singleton class can't be instantiated more than once."); } } }); // 实例 Singleton._instance = void 0; // 是否是通过getInstance实例化 Singleton._instantiateByGetInstance = false; _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=a2580489bd20abaa15763b7e4a27d901f1b0d64a.js.map