mm_expand 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/base.js +32 -4
  2. package/package.json +1 -1
package/lib/base.js CHANGED
@@ -34,7 +34,7 @@ class Base extends Event {
34
34
  // 监听事件
35
35
  this._listen();
36
36
  }
37
-
37
+
38
38
  /**
39
39
  * 获取当前状态
40
40
  * @returns {string} 当前状态
@@ -101,6 +101,15 @@ Base.prototype._onDestroy = function () {
101
101
  Base.prototype._preset = function () {
102
102
  };
103
103
 
104
+ /**
105
+ * 设置配置参数 - 内部方法
106
+ * @private
107
+ * @param {object} config 主要配置
108
+ */
109
+ Base.prototype._setConfig = function (config) {
110
+ Object.assign(this.config, config);
111
+ }
112
+
104
113
  /**
105
114
  * 设置配置参数
106
115
  * @param {object} config 主要配置
@@ -111,7 +120,7 @@ Base.prototype.setConfig = function (config) {
111
120
  if (typeof config !== 'object') {
112
121
  throw new TypeError('配置参数必须是对象');
113
122
  }
114
- Object.assign(this.config, config);
123
+ this._setConfig(config);
115
124
  }
116
125
  // 初始化设置
117
126
  this._preset();
@@ -135,13 +144,24 @@ Base.prototype._initCore = async function (...params) {
135
144
  return this;
136
145
  };
137
146
 
147
+
148
+ /**
149
+ * 初始化模块 - 内部方法
150
+ * @private
151
+ * @param {...any} params 初始化参数
152
+ * @returns {Promise<void>} 初始化完成
153
+ */
154
+ Base.prototype._init = async function (...params) {
155
+ return this;
156
+ };
157
+
138
158
  /**
139
159
  * 初始化
140
160
  * @param {...object} params 参数列表
141
161
  * @returns {object} 返回当前对象
142
162
  */
143
163
  Base.prototype.init = async function (...params) {
144
- return this;
164
+ return this._init(...params);
145
165
  };
146
166
 
147
167
  /**
@@ -152,11 +172,19 @@ Base.prototype._destroyCore = async function () {
152
172
  return this;
153
173
  };
154
174
 
175
+ /**
176
+ * 销毁模块 - 内部方法
177
+ * @private
178
+ */
179
+ Base.prototype._destroy = async function () {
180
+ return this;
181
+ };
182
+
155
183
  /**
156
184
  * 销毁
157
185
  */
158
186
  Base.prototype.destroy = async function () {
159
- return this;
187
+ return this._destroy();
160
188
  };
161
189
 
162
190
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Super Meimei Prototype Function Extension Module - Enhanced operations for string, array, object, date manipulation with error prevention and simplified business logic.",
5
5
  "main": "index.js",
6
6
  "scripts": {