ms-types 0.9.36 → 0.9.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.9.36",
3
+ "version": "0.9.37",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -19,7 +19,7 @@ function _File.mkdirs(path) return true end
19
19
 
20
20
  --- 读取文件
21
21
  --- @param path string 路径
22
- --- @return string 内容
22
+ --- @return string 内容,失败为空串
23
23
  function _File.readFile(path) return '' end
24
24
 
25
25
  --- 写入文件
@@ -40,7 +40,7 @@ function _File.deleteAllFile(path) return true end
40
40
 
41
41
  --- 读取资源文件(res 目录)
42
42
  --- @param name string 文件名
43
- --- @return string|nil 内容
43
+ --- @return string 内容,失败为空串
44
44
  function _File.readResFile(name) return '' end
45
45
 
46
46
  --- 获取 res 资源的本地文件路径;用完后应调用 cleanupResFile
@@ -74,12 +74,12 @@ function _File.appendLine(path, data) return true end
74
74
  --- 读取指定行
75
75
  --- @param path string 路径
76
76
  --- @param lineNo integer 行号
77
- --- @return string|nil 内容
77
+ --- @return string 内容,失败为空串
78
78
  function _File.readLine(path, lineNo) return '' end
79
79
 
80
80
  --- 读取所有行
81
81
  --- @param path string 路径
82
- --- @return string[] 行列表
82
+ --- @return string[] 行列表,失败为空表
83
83
  function _File.readAllLines(path) return {} end
84
84
 
85
85
  --- 复制文件
@@ -90,7 +90,7 @@ function _File.copy(src, dest) return true end
90
90
 
91
91
  --- 计算文件MD5
92
92
  --- @param path string 路径
93
- --- @return string|nil MD5
93
+ --- @return string MD5 值,失败为空串
94
94
  function _File.fileMD5(path) return '' end
95
95
 
96
96
  ---@type File
@@ -67,7 +67,7 @@ function Time() return 0 end
67
67
  ---@return string
68
68
  function ToJsonString(data) return '' end
69
69
 
70
- --- 启动同 VM 协作协程(不是 OS 线程),返回协程名
70
+ --- 启动协作协程,返回协程名
71
71
  ---@param func function
72
72
  ---@return string
73
73
  function StartThread(func) return '' end
@@ -76,7 +76,7 @@ function StartThread(func) return '' end
76
76
  ---@param threadName string
77
77
  function StopThread(threadName) end
78
78
 
79
- --- 当前协作协程是否应退出。主脚本收到停止后由引擎 hook / Sleep 直接中断,不必轮询本函数。
79
+ --- 当前协程是否应退出
80
80
  ---@return boolean
81
81
  function ShouldInterruptThread() return false end
82
82
 
@@ -4,7 +4,7 @@ local _Http = {}
4
4
 
5
5
  ---@class HttpRequestOptions
6
6
  ---@field url string @请求地址
7
- ---@field timeout integer|nil @请求超时(毫秒)
7
+ ---@field timeout integer|nil @请求超时(毫秒),默认 30000
8
8
  ---@field method string|nil @请求方法 GET/POST/...
9
9
  ---@field proxy {host:string, port:integer}|nil @代理服务器
10
10
  ---@field followRedirects boolean|nil @是否跟随重定向
@@ -47,7 +47,7 @@ end
47
47
  --- GET 请求(同名:httpGet)
48
48
  --- @param url string
49
49
  --- @param params table<string,string>|nil
50
- --- @param timeout integer|nil
50
+ --- @param timeout integer|nil 默认 30000
51
51
  --- @param headers table<string,string>|nil
52
52
  --- @return string|nil
53
53
  function _Http.httpGet(url, params, timeout, headers) return '' end
@@ -56,7 +56,7 @@ function _Http.httpGet(url, params, timeout, headers) return '' end
56
56
  --- @param url string
57
57
  --- @param params table<string,string>|nil
58
58
  --- @param files table<string,string>|nil
59
- --- @param timeout integer|nil
59
+ --- @param timeout integer|nil 默认 30000
60
60
  --- @param headers table<string,string>|nil
61
61
  --- @return string|nil
62
62
  function _Http.httpPost(url, params, files, timeout, headers) return '' end
@@ -64,7 +64,7 @@ function _Http.httpPost(url, params, files, timeout, headers) return '' end
64
64
  --- POST JSON 请求
65
65
  --- @param url string
66
66
  --- @param json table|nil
67
- --- @param timeout integer|nil
67
+ --- @param timeout integer|nil 默认 30000
68
68
  --- @param headers table<string,string>|nil
69
69
  --- @return string|nil
70
70
  function _Http.postJSON(url, json, timeout, headers) return '' end
@@ -72,7 +72,7 @@ function _Http.postJSON(url, json, timeout, headers) return '' end
72
72
  --- 下载文件(同名:downloadFile)
73
73
  --- @param url string
74
74
  --- @param file string
75
- --- @param timeout integer|nil
75
+ --- @param timeout integer|nil 默认 30000
76
76
  --- @param headers table<string,string>|nil
77
77
  --- @return boolean
78
78
  function _Http.downloadFile(url, file, timeout, headers) return true end
@@ -137,7 +137,7 @@ function _Image.cmpColor(id, points, threshold) return true end
137
137
  --- @param ey integer|nil 右下y
138
138
  --- @param threshold number 相似度 0.0-1.0
139
139
  --- @param limit integer|nil 限制个数
140
- --- @param method integer|nil 匹配方法 0|1|3|5|99
140
+ --- @param method integer|nil 匹配方法 0|1|3|5|99,默认 5
141
141
  --- @param rgb boolean|nil 是否使用RGB
142
142
  --- @param options FindImageOptions|nil 选项。scaleFactors 仅 method=99;orz 为查找方向 1-8
143
143
  --- @return Rect[] 结果矩形列表
@@ -40,7 +40,7 @@ local _Node = {}
40
40
  ---@field clickCenter fun(self: NodeInfo, duration: integer|nil): boolean 点击中心
41
41
  ---@field clickRandom fun(self: NodeInfo, duration: integer|nil): boolean 点击随机位置
42
42
  ---@field parent fun(self: NodeInfo): NodeInfo|nil 父节点
43
- ---@field child fun(self: NodeInfo, index: integer): NodeInfo|nil 子节点
43
+ ---@field child fun(self: NodeInfo, index: integer): NodeInfo|nil 子节点,index 从 0 开始
44
44
  ---@field allChildren fun(self: NodeInfo): NodeInfo[] 所有子节点
45
45
  ---@field siblings fun(self: NodeInfo): NodeInfo[] 所有兄弟节点
46
46
  ---@field previousSiblings fun(self: NodeInfo): NodeInfo[] 前兄弟节点
@@ -2,15 +2,10 @@
2
2
  ---@class System
3
3
  local _System = {}
4
4
 
5
- ---@class ProcessArguments
6
- ---@field env table<string, any> 环境变量映射(键为字符串,值为任意类型)
7
- ---@field args string[] 启动参数列表
8
-
9
5
  ---@class ActivateAppInfo
10
6
  ---@field name string 应用名称
11
7
  ---@field pid integer 进程 ID
12
8
  ---@field bundleId string 应用 Bundle ID
13
- ---@field processArguments ProcessArguments 启动参数信息
14
9
 
15
10
  ---@class MemoryInfo
16
11
  ---@field used integer 已使用内存(MB)
@@ -20,10 +15,8 @@ local _System = {}
20
15
 
21
16
  --- 启动应用
22
17
  --- @param bundleId string 应用 Bundle ID
23
- --- @param args string[]|nil 启动参数
24
- --- @param env table<string, any>|nil 环境变量
25
18
  --- @return boolean 成功
26
- function _System.startApp(bundleId, args, env) return true end
19
+ function _System.startApp(bundleId) return true end
27
20
 
28
21
  --- 停止应用
29
22
  --- @param bundleId string 应用 Bundle ID