mm_machine 1.9.2 → 1.9.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.
@@ -1,7 +1,7 @@
1
1
  var i = 0;
2
2
 
3
3
  function test() {
4
- console.log("你好7654321011", i++)
4
+ console.log("你好7654321", i++)
5
5
  }
6
6
 
7
7
  function main() {
package/index.js CHANGED
@@ -79,7 +79,7 @@ Index.prototype.load_item = async function(dir, cg, file) {
79
79
  drive.mode = this.mode;
80
80
  if (cg) {
81
81
  await drive.run('load_config', file, cg.name);
82
- drive.set_config(cg);
82
+ await drive.run('set_config', cg);
83
83
  } else {
84
84
  await drive.run('load_config', file);
85
85
  }
@@ -195,12 +195,12 @@ Index.prototype.update_config_have = async function(dir) {
195
195
  for (var n = 0; n < lt.length; n++) {
196
196
  var cg = lt[n];
197
197
  if (cg.name == o.config.name) {
198
- o.set_config(cg);
198
+ await o.run('set_config', cg);
199
199
  continue;
200
200
  }
201
201
  }
202
202
  } else {
203
- o.set_config(config);
203
+ await o.run('set_config', config);
204
204
  }
205
205
  }
206
206
  }
package/item.js CHANGED
@@ -98,7 +98,6 @@ class Item {
98
98
  */
99
99
  Item.prototype.set_config = function(config) {
100
100
  this.config = conf(Object.assign({}, this.config, config || {}), this.filename);
101
- this.set_config_after();
102
101
  }
103
102
 
104
103
  /**
@@ -247,6 +246,7 @@ Item.prototype.load_file = function(file, name) {
247
246
  var o = list[i];
248
247
  if (this.config.name === o.name) {
249
248
  this.set_config(o);
249
+ this.set_config_after();
250
250
  if (this.mode === 3 || this.mode === 4) {
251
251
  this.reload_script();
252
252
  }
@@ -255,6 +255,7 @@ Item.prototype.load_file = function(file, name) {
255
255
  }
256
256
  } else {
257
257
  this.set_config(conf);
258
+ this.set_config_after();
258
259
  if (this.mode === 3 || this.mode === 4) {
259
260
  this.reload_script();
260
261
  }
@@ -349,6 +350,7 @@ Item.prototype.load_config = function(cg, name) {
349
350
  config = this.load_file(this.filename, name);
350
351
  }
351
352
  this.set_config(config);
353
+ this.set_config_after();
352
354
  };
353
355
 
354
356
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_machine",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "这是超级美眉框架机制构建辅助模块,用于快速构建一个机制",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -76,12 +76,12 @@ async function demo() {
76
76
  console.log("这结果", ret);
77
77
  }, 7000)
78
78
 
79
- // setTimeout(() => {
80
- // var file = "./demo/test2/index.js";
81
- // var text = file.loadText();
82
- // text = text.replace("123", "7654321");
83
- // file.saveText(text);
84
- // }, 11000)
79
+ setTimeout(() => {
80
+ var file = "./demo/test2/index.js";
81
+ var text = file.loadText();
82
+ text = text.replace("123", "7654321");
83
+ file.saveText(text);
84
+ }, 11000)
85
85
 
86
86
  setTimeout(async () => {
87
87
  // 让热重载失效
@@ -105,11 +105,11 @@ async function demo() {
105
105
  if (plug) {
106
106
  console.log("查看变化1", plug.config);
107
107
  }
108
- // var plug = engine.get("demo3");
109
- // if (plug) {
110
- // var ret = await plug.run('main');
111
- // console.log("查看变化3", plug.config);
112
- // }
108
+ var plug = engine.get("demo3");
109
+ if (plug) {
110
+ var ret = await plug.run('main');
111
+ console.log("查看变化3", plug.config);
112
+ }
113
113
  n++;
114
114
  if (n == 6) {
115
115
  clearInterval(timer_2);