mm_machine 1.4.6 → 1.4.9

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/index.js +34 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -229,7 +229,7 @@ Item.prototype.load = function(cg) {
229
229
  config = cg;
230
230
  }
231
231
  this.set_config(config);
232
- this.loadObj(config);
232
+ this.loadObj(this.config);
233
233
  };
234
234
 
235
235
  /**
@@ -265,6 +265,25 @@ Item.prototype.main = function(param1, param2) {
265
265
  return null;
266
266
  };
267
267
 
268
+ /**
269
+ * 运行指令
270
+ * @param {Number} state 状态 0为不可以,1为可用
271
+ * @param {Array} ...params 参数集合
272
+ */
273
+ Item.prototype.run_cmd = function(state, ...params){
274
+ return null;
275
+ };
276
+
277
+ /**
278
+ * 下达指令
279
+ * @param {Number} state 状态 0为不可以,1为可用
280
+ * @param {Array} ...params 参数集合
281
+ */
282
+ Item.prototype.cmd = function(state, ...params){
283
+ this.config.state = state;
284
+ return this.run_cmd(state, ...param);
285
+ }
286
+
268
287
  /**
269
288
  * @module 导出Drive类
270
289
  */
@@ -435,6 +454,20 @@ Index.prototype.get = function(name) {
435
454
  return obj;
436
455
  };
437
456
 
457
+ /**
458
+ * 下达指令
459
+ * @param {String} name 名称
460
+ * @param {Number} state 状态
461
+ * @param {Array} ...params 参数集合
462
+ */
463
+ Index.prototype.cmd = async function(name, state, ...params){
464
+ var obj = this.get(name);
465
+ if(!obj){
466
+ return "error: program does not exist";
467
+ }
468
+ return await obj.cmd(name, ...params);
469
+ }
470
+
438
471
  /**
439
472
  * @description 查询配置项
440
473
  * @param {String} name 名称
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "1.4.6",
3
+ "version": "1.4.9",
4
4
  "description": "这是超级美眉框架机制构建辅助模块,用于快速构建一个机制",
5
5
  "main": "index.js",
6
6
  "scripts": {