mm_machine 1.4.7 → 1.4.8
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.
- package/index.js +33 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -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 名称
|