@dobot-plus/template 1.0.8 → 1.2.0
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/lua/httpAPI.lua +8 -7
- package/lua/userAPI.lua +6 -6
- package/package.json +2 -1
package/lua/httpAPI.lua
CHANGED
|
@@ -32,9 +32,10 @@ end
|
|
|
32
32
|
--- 该方法会在http请求接收到后,自动执行,对应请求的 url为: http://<控制器ip>:<插件端口>/dobotPlus/[插件名]_[插件版本]/demoMethod1。
|
|
33
33
|
httpModule.demoMethod1 = function(params)
|
|
34
34
|
-- TODO 需要在接收到http请求后执行的操作
|
|
35
|
+
control.controlMethod1(params)
|
|
35
36
|
return {
|
|
36
37
|
--- Your responce data
|
|
37
|
-
|
|
38
|
+
status = true
|
|
38
39
|
}
|
|
39
40
|
end
|
|
40
41
|
|
|
@@ -43,10 +44,10 @@ end
|
|
|
43
44
|
--- @param params table
|
|
44
45
|
--- @return string
|
|
45
46
|
httpModule.demoMethod2 = function(params)
|
|
46
|
-
|
|
47
|
+
control.controlMethod2(params)
|
|
47
48
|
return {
|
|
48
49
|
--- Your responce data
|
|
49
|
-
|
|
50
|
+
status = true
|
|
50
51
|
}
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -55,11 +56,11 @@ end
|
|
|
55
56
|
--- @param params table
|
|
56
57
|
--- @return string The return value will response the http request, the return value is not necessory
|
|
57
58
|
httpModule.demoMethod3 = function(params)
|
|
58
|
-
|
|
59
|
+
control.controlMethod3(params)
|
|
59
60
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
--- Your responce data
|
|
62
|
+
status = true
|
|
63
|
+
}
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
return httpModule
|
package/lua/userAPI.lua
CHANGED
|
@@ -11,21 +11,21 @@ local userApiModule = {}
|
|
|
11
11
|
--- This function can be used in the httpAPI module also
|
|
12
12
|
---@param params table
|
|
13
13
|
function userApiModule.demoMethod1(params)
|
|
14
|
-
|
|
14
|
+
return control.controlMethod1(params)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
--- This function will be called when you add it in the blockly programming or script programming
|
|
18
18
|
--- This function can be used in the httpAPI module also
|
|
19
19
|
---@param params table
|
|
20
20
|
function userApiModule.demoMethod2(params)
|
|
21
|
-
|
|
21
|
+
return control.controlMethod2(params)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
--- This function will be called when you add it in the blockly programming or script programming
|
|
25
25
|
--- This function can be used in the httpAPI module also
|
|
26
26
|
---@param params table
|
|
27
27
|
function userApiModule.demoMethod3(params)
|
|
28
|
-
|
|
28
|
+
return control.controlMethod3(params)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
-- This function will be called when the plugin is installed
|
|
@@ -36,9 +36,9 @@ end
|
|
|
36
36
|
function userApiModule.OnRegist()
|
|
37
37
|
EcoLog(" --- OnRegist .... --- ")
|
|
38
38
|
-- 0. 接口导出
|
|
39
|
-
local isErr = ExportFunction("
|
|
40
|
-
ExportFunction("
|
|
41
|
-
ExportFunction("
|
|
39
|
+
local isErr = ExportFunction("demoMethod1", userApiModule.demoMethod1) or
|
|
40
|
+
ExportFunction("demoMethod2", userApiModule.demoMethod2) or
|
|
41
|
+
ExportFunction("demoMethod3", userApiModule.demoMethod3)
|
|
42
42
|
-- 1. 错误的处理
|
|
43
43
|
if isErr then
|
|
44
44
|
EcoLog(" --- ERR to register .... --- ", isErr)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dobot-plus/template",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "20"
|
|
6
6
|
},
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@dobot-plus/components": "latest",
|
|
15
15
|
"@dobot-plus/lua": "latest",
|
|
16
|
+
"@dobot-plus/gui": "latest",
|
|
16
17
|
"antd": "^5.22.3",
|
|
17
18
|
"axios": "^1.3.3",
|
|
18
19
|
"i18next": "^23.12.2",
|