mm_machine 1.4.8 → 1.5.1
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 +12 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ class Item {
|
|
|
61
61
|
*/
|
|
62
62
|
"sort": 10,
|
|
63
63
|
/**
|
|
64
|
-
* 状态, 1
|
|
64
|
+
* 状态, 0表示未启用, 1表示启用
|
|
65
65
|
*/
|
|
66
66
|
"state": 1
|
|
67
67
|
};
|
|
@@ -78,7 +78,7 @@ class Item {
|
|
|
78
78
|
* @param {Object} config 配置
|
|
79
79
|
*/
|
|
80
80
|
Item.prototype.set_config = function(config){
|
|
81
|
-
this.config = conf(Object.assign(this.config, config || {}));
|
|
81
|
+
this.config = conf(Object.assign({}, this.config, config || {}));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -114,10 +114,19 @@ Item.prototype.remove_module = function(module) {
|
|
|
114
114
|
* @param {Object} obj 配置对象
|
|
115
115
|
*/
|
|
116
116
|
Item.prototype.loadObj = function(config) {
|
|
117
|
+
if(!config){
|
|
118
|
+
config = this.config;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
config = Object.assign({}, config, this.config);
|
|
122
|
+
}
|
|
117
123
|
var f = config.func_file;
|
|
118
124
|
if (f) {
|
|
119
125
|
var file = f.fullname(this.dir);
|
|
120
126
|
if (file.hasFile()) {
|
|
127
|
+
if(!config.state){
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
121
130
|
this.remove_module(file);
|
|
122
131
|
var cs = require(file);
|
|
123
132
|
if (cs) {
|
|
@@ -281,7 +290,7 @@ Item.prototype.run_cmd = function(state, ...params){
|
|
|
281
290
|
*/
|
|
282
291
|
Item.prototype.cmd = function(state, ...params){
|
|
283
292
|
this.config.state = state;
|
|
284
|
-
return this.run_cmd(
|
|
293
|
+
return this.run_cmd(state, ...param);
|
|
285
294
|
}
|
|
286
295
|
|
|
287
296
|
/**
|