mm_machine 2.3.1 → 2.3.2

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/mod.js +7 -7
  2. package/package.json +1 -1
package/mod.js CHANGED
@@ -336,25 +336,25 @@ Mod.prototype.emitEvent = function (event, ...args) {
336
336
 
337
337
  /**
338
338
  * 运行方法
339
- * @param {string} method 方法名
340
339
  * @param {...any} args 方法参数
341
340
  * @returns {Promise<any>} 方法执行结果
342
341
  */
343
- Mod.prototype.run = async function (method, ...args) {
344
- return this.main(method, ...args);
342
+ Mod.prototype.run = async function (...args) {
343
+ return this.main(...args);
345
344
  };
346
345
 
347
346
  /**
348
- * 主方法
349
- * @param {string} method 方法名
347
+ * 主方法名
350
348
  * @param {...any} args 方法参数
351
349
  * @returns {Promise<any>} 方法执行结果
352
350
  */
353
- Mod.prototype.main = async function (method, ...args) {
351
+ Mod.prototype.main = async function (...args) {
352
+ let method = args[0];
354
353
  if (!this.methods?.[method]) {
355
354
  throw new Error(`方法${method}不存在`);
356
355
  }
357
- return await this.methods[method](...args);
356
+ let params = args.slice(1);
357
+ return await this.methods[method](...params);
358
358
  };
359
359
 
360
360
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "A flexible Node.js plugin mechanism system for dynamic loading, management and execution of modules. Supports hot reload, lifecycle management, and modern JavaScript features.",
5
5
  "main": "index.js",
6
6
  "scripts": {