mm_machine 2.2.3 → 2.2.5
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/README.md +7 -7
- package/index.js +501 -641
- package/item.js +697 -786
- package/package.json +11 -8
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ async function init() {
|
|
|
47
47
|
await engine.loads();
|
|
48
48
|
|
|
49
49
|
// 执行所有模块的main方法
|
|
50
|
-
const results = await engine.
|
|
50
|
+
const results = await engine.exec('main');
|
|
51
51
|
$.log.debug('执行结果:', results);
|
|
52
52
|
|
|
53
53
|
// 获取特定模块
|
|
@@ -79,7 +79,7 @@ init().catch((err) => {
|
|
|
79
79
|
"sort": 10,
|
|
80
80
|
"state": 1,
|
|
81
81
|
"show": 1,
|
|
82
|
-
"
|
|
82
|
+
"options": {
|
|
83
83
|
"debug": true,
|
|
84
84
|
"timeout": 3000
|
|
85
85
|
}
|
|
@@ -166,7 +166,7 @@ async function init() {
|
|
|
166
166
|
await engine.loads();
|
|
167
167
|
|
|
168
168
|
// 执行所有模块的main方法
|
|
169
|
-
await engine.
|
|
169
|
+
await engine.exec('main');
|
|
170
170
|
|
|
171
171
|
// 获取特定模块
|
|
172
172
|
const demo1 = engine.get('demo1');
|
|
@@ -174,7 +174,7 @@ async function init() {
|
|
|
174
174
|
$.log.debug('模块1状态:', demo1.state ? '启用' : '禁用');
|
|
175
175
|
|
|
176
176
|
// 执行特定模块的自定义方法
|
|
177
|
-
const result = await engine.
|
|
177
|
+
const result = await engine.exec('my_custom_method', 'demo1');
|
|
178
178
|
$.log.debug('自定义方法结果:', result);
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -201,7 +201,7 @@ init().catch((err) => {
|
|
|
201
201
|
"sort": 10,
|
|
202
202
|
"state": 1,
|
|
203
203
|
"show": 1,
|
|
204
|
-
"
|
|
204
|
+
"options": {
|
|
205
205
|
"debug": true,
|
|
206
206
|
"timeout": 3000,
|
|
207
207
|
"api_key": "your_api_key_here"
|
|
@@ -362,7 +362,7 @@ async function run() {
|
|
|
362
362
|
|
|
363
363
|
// 安全地执行模块方法
|
|
364
364
|
try {
|
|
365
|
-
const result = await engine.
|
|
365
|
+
const result = await engine.exec('main');
|
|
366
366
|
$.log.debug('执行结果:', result);
|
|
367
367
|
} catch (err) {
|
|
368
368
|
$.log.error('执行方法时出错:', err);
|
|
@@ -371,7 +371,7 @@ async function run() {
|
|
|
371
371
|
|
|
372
372
|
// 单独执行特定模块并捕获可能的错误
|
|
373
373
|
try {
|
|
374
|
-
const demo1Result = await engine.
|
|
374
|
+
const demo1Result = await engine.exec('main', 'demo1');
|
|
375
375
|
$.log.debug('demo1 执行结果:', demo1Result);
|
|
376
376
|
} catch (err) {
|
|
377
377
|
$.log.error('执行 demo1 时出错:', err);
|