ms-types 0.0.68 → 0.0.70

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.0.68",
3
+ "version": "0.0.70",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/types/http.d.ts CHANGED
@@ -190,6 +190,25 @@ declare namespace http {
190
190
  headers?: Record<string, string>
191
191
  ): string;
192
192
 
193
+ /**
194
+ * 创建WebSocket连接
195
+ * @param url 连接地址
196
+ * @param header 连接头
197
+ * @returns WebSocket连接对象
198
+ * @example
199
+ * const ws = http.newWebsocket("ws://www.baidu.com")
200
+ * ws.connect()
201
+ * ws.onText((data) => {
202
+ * logi(data)
203
+ * })
204
+ * ws.sendText("hello")
205
+ * ws.close()
206
+ */
207
+ function newWebsocket(
208
+ url: string,
209
+ header?: Record<string, string>
210
+ ): WebSocket;
211
+
193
212
  /**
194
213
  * WebSocket连接
195
214
  */
@@ -278,23 +297,4 @@ declare namespace http {
278
297
  */
279
298
  setAutoReconnect(autoReconnect: boolean): void;
280
299
  }
281
-
282
- /**
283
- * 创建WebSocket连接
284
- * @param url 连接地址
285
- * @param header 连接头
286
- * @returns WebSocket连接对象
287
- * @example
288
- * const ws = http.newWebsocket("ws://www.baidu.com")
289
- * ws.connect()
290
- * ws.onText((data) => {
291
- * logi(data)
292
- * })
293
- * ws.sendText("hello")
294
- * ws.close()
295
- */
296
- function newWebsocket(
297
- url: string,
298
- header?: Record<string, string>
299
- ): WebSocket;
300
300
  }
package/types/image.d.ts CHANGED
@@ -271,18 +271,17 @@ declare namespace image {
271
271
  function pixel(imageId: string, x: number, y: number): number;
272
272
  /**
273
273
  * 将整型的颜色值转成16进制RGB字符串
274
- * @param imageId 图片id
275
274
  * @param color 颜色值
276
275
  * @returns 16进制RGB字符串
277
276
  * @example
278
277
  * const imageId = image.readImage("screen.jpg")
279
278
  * if (imageId) {
280
279
  * const color = image.pixel(imageId, 0, 0)
281
- * logi(image.argb(imageId, color))
280
+ * logi(image.argb(color))
282
281
  * }
283
282
  * image.release(imageId)
284
283
  */
285
- function argb(imageId: string, color: number): string;
284
+ function argb(color: number): string;
286
285
  /**
287
286
  * 二值化
288
287
  * @param imageId 图片id
@@ -191,6 +191,25 @@ declare namespace $HTTP {
191
191
  请求头?: 字典<字符串>
192
192
  ): 字符串;
193
193
 
194
+ /**
195
+ * 创建WebSocket连接
196
+ * @param 连接地址
197
+ * @param 连接头
198
+ * @returns WebSocket连接对象
199
+ * @example
200
+ * const ws连接 = $HTTP.创建WebSocket连接("ws://www.baidu.com")
201
+ * ws连接.连接()
202
+ * ws连接.监听文本消息回调((data) => {
203
+ * $打印信息日志(data)
204
+ * })
205
+ * ws连接.发送文本("hello")
206
+ * ws连接.关闭()
207
+ */
208
+ function 创建WebSocket连接(
209
+ 连接地址: 字符串,
210
+ 连接头?: 字典<字符串>
211
+ ): WebSocket连接;
212
+
194
213
  /**
195
214
  * WebSocket连接
196
215
  */
@@ -279,23 +298,4 @@ declare namespace $HTTP {
279
298
  */
280
299
  设置自动重连(是否自动重连: 布尔值): 无返回值;
281
300
  }
282
-
283
- /**
284
- * 创建WebSocket连接
285
- * @param 连接地址
286
- * @param 连接头
287
- * @returns WebSocket连接对象
288
- * @example
289
- * const ws连接 = $HTTP.创建WebSocket连接("ws://www.baidu.com")
290
- * ws连接.连接()
291
- * ws连接.监听文本消息回调((data) => {
292
- * $打印信息日志(data)
293
- * })
294
- * ws连接.发送文本("hello")
295
- * ws连接.关闭()
296
- */
297
- function 创建WebSocket连接(
298
- 连接地址: 字符串,
299
- 连接头?: 字典<字符串>
300
- ): WebSocket连接;
301
301
  }
@@ -55,14 +55,14 @@ declare namespace $MySQL数据库 {
55
55
  * $打印信息日志("数据库连接成功")
56
56
  * }
57
57
  */
58
- function 连接(config: MySQL连接配置): 布尔值;
58
+ function 连接(连接配置: MySQL连接配置): 布尔值;
59
59
 
60
60
  /**
61
61
  * 断开数据库连接
62
62
  * @example
63
63
  * $MySQL数据库.断开连接()
64
64
  */
65
- function 断开连接(): void;
65
+ function 断开连接(): 无返回值;
66
66
 
67
67
  /**
68
68
  * 检查连接状态
@@ -82,7 +82,7 @@ declare namespace $YOLO {
82
82
  目标检测输入大小?: 数字,
83
83
  置信度?: 数字,
84
84
  重叠阈值?: 数字
85
- ): Yolo检测结果[];
85
+ ): 数组<Yolo检测结果>;
86
86
 
87
87
  /**
88
88
  * 释放指定模型资源
@@ -1,4 +1,3 @@
1
- declare type 回调 = Function;
2
1
  declare type 布尔值 = boolean;
3
2
  declare type 字符串 = string;
4
3
  declare type 数字 = number;
@@ -20,31 +19,31 @@ declare const $假: 布尔值;
20
19
  /**
21
20
  * 是否是调试模式
22
21
  */
23
- declare const $是否调试: boolean;
22
+ declare const $是否调试: 布尔值;
24
23
  /**
25
24
  * 是否应该退出应用
26
25
  */
27
- declare const $是否退出: boolean;
26
+ declare const $是否退出: 布尔值;
28
27
  /**
29
28
  * 应用版本
30
29
  */
31
- declare const $APP应用版本: string;
30
+ declare const $APP应用版本: 字符串;
32
31
  /**
33
32
  * 应用构建号
34
33
  */
35
- declare const $APP应用构建号: string;
34
+ declare const $APP应用构建号: 字符串;
36
35
  /**
37
36
  * 应用名称
38
37
  */
39
- declare const $APP应用名称: string;
38
+ declare const $APP应用名称: 字符串;
40
39
  /**
41
40
  * 应用 bundleId
42
41
  */
43
- declare const $APP应用包名: string;
42
+ declare const $APP应用包名: 字符串;
44
43
  /**
45
44
  * 当前线程名称
46
45
  */
47
- declare const $线程名称: string;
46
+ declare const $线程名称: 字符串;
48
47
  /**
49
48
  * 脚本信息
50
49
  */
@@ -68,7 +67,7 @@ declare const $脚本配置: {
68
67
  * $打印信息日志("脚本执行完成");
69
68
  * });
70
69
  */
71
- declare const $设置停止回调: (回调: 回调) => 无返回值;
70
+ declare const $设置停止回调: (回调: () => 无返回值) => 无返回值;
72
71
 
73
72
  /**
74
73
  * 设置异常停止回调(仅主线程调用)
@@ -79,7 +78,7 @@ declare const $设置停止回调: (回调: 回调) => 无返回值;
79
78
  * $打印错误日志("脚本执行异常");
80
79
  * });
81
80
  */
82
- declare const $设置异常停止回调: (回调: 回调) => 无返回值;
81
+ declare const $设置异常停止回调: (回调: () => 无返回值) => 无返回值;
83
82
 
84
83
  /**
85
84
  * 重启脚本(仅主线程调用)
@@ -64,13 +64,13 @@ declare namespace $图片 {
64
64
  * @param path 图片路径
65
65
  * @returns 图片id ,如果读取失败则返回null
66
66
  * @example
67
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
67
+ * const 图片ID = $图片.读取图片("screen.jpg")
68
68
  * if (图片ID) {
69
69
  * $图片.保存图片(图片ID, "screen.jpg")
70
70
  * }
71
71
  * $图片.释放图片(图片ID)
72
72
  */
73
- function 从文件读取图片(图片路径: 字符串): 字符串 | null;
73
+ function 读取图片(图片路径: 字符串): 字符串 | null;
74
74
  /**
75
75
  * 读取资源图片
76
76
  * @param fileName 文件名
@@ -85,7 +85,7 @@ declare namespace $图片 {
85
85
  * @param degree 旋转角度 只能是 90 -90 180
86
86
  * @returns 旋转后的图片id ,如果旋转失败则返回null
87
87
  * @example
88
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
88
+ * const 图片ID = $图片.读取图片("screen.jpg")
89
89
  * if (图片ID) {
90
90
  * const 新图片ID = $图片.旋转图片(图片ID, 90)
91
91
  * if (新图片ID) {
@@ -106,7 +106,7 @@ declare namespace $图片 {
106
106
  * @param 区域右下角y 全屏传0
107
107
  * @returns true 相同 false 不同
108
108
  * @example
109
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
109
+ * const 图片ID = $图片.读取图片("screen.jpg")
110
110
  * if (图片ID) {
111
111
  * const isSame = $图片.多点比色(图片ID, "1|2|#6DD1E6-#101010", 10, 0, 0, 100, 100)
112
112
  * if (isSame) {
@@ -137,7 +137,7 @@ declare namespace $图片 {
137
137
  * @param 查找方向 1-8
138
138
  * @returns 颜色点数组
139
139
  * @example
140
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
140
+ * const 图片ID = $图片.读取图片("screen.jpg")
141
141
  * if (图片ID) {
142
142
  * const 颜色点数组 = $图片.单点找色(图片ID, "0x6DD1E6-0x101010", 10, 0, 0, 100, 100, 1, 1)
143
143
  * if (颜色点数组.length > 0) {
@@ -171,7 +171,7 @@ declare namespace $图片 {
171
171
  * @param 查找方向 1-8
172
172
  * @returns 颜色点数组
173
173
  * @example
174
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
174
+ * const 图片ID = $图片.读取图片("screen.jpg")
175
175
  * if (图片ID) {
176
176
  * const 颜色点数组 = $图片.多点找色(图片ID, "0x6DD1E6-0x101010", 10, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
177
177
  * if (颜色点数组.length > 0) {
@@ -240,7 +240,7 @@ declare namespace $图片 {
240
240
  * @param 区域右下角y
241
241
  * @returns 裁剪后的图片ID
242
242
  * @example
243
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
243
+ * const 图片ID = $图片.读取图片("screen.jpg")
244
244
  * if (图片ID) {
245
245
  * const 裁剪后的图片ID = $图片.裁剪图片(图片ID, 0, 0, 100, 100)
246
246
  * if (裁剪后的图片ID) {
@@ -263,7 +263,7 @@ declare namespace $图片 {
263
263
  * @param 坐标y
264
264
  * @returns 颜色值
265
265
  * @example
266
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
266
+ * const 图片ID = $图片.读取图片("screen.jpg")
267
267
  * if (图片ID) {
268
268
  * const 颜色值 = $图片.取像素颜色(图片ID, 0, 0)
269
269
  * $打印信息日志(颜色值)
@@ -273,25 +273,24 @@ declare namespace $图片 {
273
273
  function 取像素颜色(图片ID: 字符串, 坐标x: 数字, 坐标y: 数字): 数字;
274
274
  /**
275
275
  * 将整型的颜色值转成16进制RGB字符串
276
- * @param 图片ID
277
276
  * @param 颜色值
278
277
  * @returns 16进制RGB字符串
279
278
  * @example
280
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
279
+ * const 图片ID = $图片.读取图片("screen.jpg")
281
280
  * if (图片ID) {
282
281
  * const 颜色值 = $图片.取像素颜色(图片ID, 0, 0)
283
- * $打印信息日志($图片.颜色转16进制字符串(图片ID, 颜色值))
282
+ * $打印信息日志($图片.颜色转16进制字符串(颜色值))
284
283
  * }
285
284
  * $图片.释放图片(图片ID)
286
285
  */
287
- function 颜色转16进制字符串(图片ID: 字符串, 颜色值: 数字): 字符串;
286
+ function 颜色转16进制字符串(颜色值: 数字): 字符串;
288
287
  /**
289
288
  * 二值化
290
289
  * @param 图片ID
291
290
  * @param 阈值
292
291
  * @returns 二值化后的图片ID
293
292
  * @example
294
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
293
+ * const 图片ID = $图片.读取图片("screen.jpg")
295
294
  * if (图片ID) {
296
295
  * const 二值化图片ID = $图片.二值化图片(图片ID, 128)
297
296
  * if (二值化图片ID) {
@@ -306,7 +305,7 @@ declare namespace $图片 {
306
305
  * @param 图片ID
307
306
  * @returns 灰度化后的图片ID
308
307
  * @example
309
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
308
+ * const 图片ID = $图片.读取图片("screen.jpg")
310
309
  * if (图片ID) {
311
310
  * const 灰度化图片ID = $图片.灰度化图片(图片ID)
312
311
  * if (灰度化图片ID) {
@@ -335,7 +334,7 @@ declare namespace $图片 {
335
334
  * @param 质量 质量 1-100 数字越大质量越高
336
335
  * @returns base64字符串
337
336
  * @example
338
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
337
+ * const 图片ID = $图片.读取图片("screen.jpg")
339
338
  * if (图片ID) {
340
339
  * const base64 = $图片.图片转base64(图片ID, "jpg", 100)
341
340
  * $打印信息日志(base64)
@@ -348,7 +347,7 @@ declare namespace $图片 {
348
347
  * @param 图片ID 图片ID
349
348
  * @returns 条码内容
350
349
  * @example
351
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
350
+ * const 图片ID = $图片.读取图片("screen.jpg")
352
351
  * if (图片ID) {
353
352
  * const 条码内容 = $图片.扫描条码(图片ID)
354
353
  * if (条码内容) {
@@ -369,7 +368,7 @@ declare namespace $图片 {
369
368
  * @param 线宽 线宽
370
369
  * @returns 无返回值
371
370
  * @example
372
- * const 图片ID = $图片.从文件读取图片("screen.jpg")
371
+ * const 图片ID = $图片.读取图片("screen.jpg")
373
372
  * if (图片ID) {
374
373
  * $图片.绘制矩形(图片ID, 0, 0, 100, 100, "#ff0000", 1)
375
374
  * }
@@ -50,5 +50,5 @@ declare namespace $悬浮窗 {
50
50
  * 设置是否允许悬浮窗控制脚本启停
51
51
  * @param 是否允许 true代表允许,false代表不允许
52
52
  */
53
- function 设置日志窗口是否允许脚本控制(是否允许: 布尔值): 无返回值;
53
+ function 设置是否允许控制脚本启停(是否允许: 布尔值): 无返回值;
54
54
  }
@@ -25,7 +25,7 @@ declare namespace $文件 {
25
25
  * @returns 文件路径
26
26
  * @example $文件.获取数据文件("config.json")
27
27
  */
28
- function 获取数据文件(文件名称: 字符串): 字符串;
28
+ function 获取数据文件路径(文件名称: 字符串): 字符串;
29
29
  /**
30
30
  * 创建文件
31
31
  * @param 文件路径
@@ -86,7 +86,7 @@ declare namespace $文字转语音 {
86
86
  /**
87
87
  * 释放TTS资源(调用时,会停止当前播放并释放资源)
88
88
  * @example
89
- * $文字转语音.释放TTS资源();
89
+ * $文字转语音.释放资源();
90
90
  */
91
- function 释放TTS资源(): 无返回值;
91
+ function 释放资源(): 无返回值;
92
92
  }
@@ -69,7 +69,7 @@ declare namespace $系统 {
69
69
  * $打印信息日志("锁屏")
70
70
  * }
71
71
  */
72
- function 是否锁屏(): boolean;
72
+ function 是否锁屏(): 布尔值;
73
73
  /**
74
74
  * 锁屏
75
75
  * @returns 是否锁屏成功
@@ -79,7 +79,7 @@ declare namespace $系统 {
79
79
  * $打印信息日志("锁屏成功")
80
80
  * }
81
81
  */
82
- function 锁屏(): boolean;
82
+ function 锁屏(): 布尔值;
83
83
  /**
84
84
  * 解锁 如果有密码 会停在解锁界面
85
85
  * @returns 是否解锁成功
@@ -89,7 +89,7 @@ declare namespace $系统 {
89
89
  * $打印信息日志("解锁成功")
90
90
  * }
91
91
  */
92
- function 解锁(): boolean;
92
+ function 解锁(): 布尔值;
93
93
  /**
94
94
  * 设置剪贴板 APP 在前台运行时才能设置
95
95
  * @param text 剪贴板内容
@@ -151,7 +151,7 @@ declare namespace $系统 {
151
151
  * const 已使用内存 = $系统.获取已使用内存()
152
152
  * $打印信息日志(`已使用内存: ${已使用内存}MB`)
153
153
  */
154
- function 获取已使用内存(): number;
154
+ function 获取已使用内存(): 数字;
155
155
  /**
156
156
  * 获取可用内存
157
157
  * @returns 可用内存大小(单位:MB)
@@ -159,7 +159,7 @@ declare namespace $系统 {
159
159
  * const 可用内存 = $系统.获取可用内存()
160
160
  * $打印信息日志(`可用内存: ${可用内存}MB`)
161
161
  */
162
- function 获取可用内存(): number;
162
+ function 获取可用内存(): 数字;
163
163
  /**
164
164
  * 获取系统总内存
165
165
  * @returns 系统总内存大小(单位:MB)
@@ -167,7 +167,7 @@ declare namespace $系统 {
167
167
  * const 总内存 = $系统.获取系统总内存()
168
168
  * $打印信息日志(`系统总内存: ${总内存}MB`)
169
169
  */
170
- function 获取系统总内存(): number;
170
+ function 获取系统总内存(): 数字;
171
171
  /**
172
172
  * 启动 WDA 服务
173
173
  * @returns 是否启动成功
@@ -177,7 +177,7 @@ declare namespace $系统 {
177
177
  * $打印信息日志("WDA 启动成功")
178
178
  * }
179
179
  */
180
- function 启动WDA服务(): boolean;
180
+ function 启动WDA服务(): 布尔值;
181
181
  /**
182
182
  * 获取 WDA 状态
183
183
  * @returns WDA 是否正在运行
@@ -189,5 +189,5 @@ declare namespace $系统 {
189
189
  * $打印信息日志("WDA 服务未运行")
190
190
  * }
191
191
  */
192
- function 获取WDA状态(): boolean;
192
+ function 获取WDA状态(): 布尔值;
193
193
  }
@@ -89,14 +89,14 @@ declare namespace $线程 {
89
89
  * $打印信息日志(数据)
90
90
  * return "1111"
91
91
  * })
92
- * $线程.线程是否已被取消(新线程.name)
92
+ * $线程.是否已被取消(新线程.name)
93
93
  */
94
- function 线程是否已被取消(线程名称: 字符串): 布尔值;
94
+ function 是否已被取消(线程名称: 字符串): 布尔值;
95
95
  /**
96
- * 停止所有线程
96
+ * 停止所有
97
97
  * @returns 是否停止成功
98
98
  * @example
99
- * $线程.停止所有线程()
99
+ * $线程.停止所有()
100
100
  */
101
- function 停止所有线程(): 布尔值;
101
+ function 停止所有(): 布尔值;
102
102
  }
@@ -104,7 +104,7 @@ declare namespace $视图 {
104
104
  * })
105
105
  */
106
106
  function 监听事件回调(
107
- 回调函数: (事件名称: string, 数据: 字典<任意类型>) => 无返回值
107
+ 回调函数: (事件名称: 字符串, 数据: 字典<任意类型>) => 无返回值
108
108
  ): 无返回值;
109
109
 
110
110
  /**
@@ -12,11 +12,11 @@ declare namespace $设备 {
12
12
  /**
13
13
  * 电池电量
14
14
  */
15
- level: number;
15
+ level: 数字;
16
16
  /**
17
17
  * 是否充电
18
18
  */
19
- isCharging: boolean;
19
+ isCharging: 布尔值;
20
20
  };
21
21
  /**
22
22
  * 获取设备ID
@@ -51,11 +51,11 @@ declare namespace $设备 {
51
51
  /**
52
52
  * 屏幕宽度
53
53
  */
54
- width: number;
54
+ width: 数字;
55
55
  /**
56
56
  * 屏幕高度
57
57
  */
58
- height: number;
58
+ height: 数字;
59
59
  };
60
60
  /**
61
61
  * 获取屏幕实际大小
@@ -66,11 +66,11 @@ declare namespace $设备 {
66
66
  /**
67
67
  * 屏幕宽度
68
68
  */
69
- width: number;
69
+ width: 数字;
70
70
  /**
71
71
  * 屏幕高度
72
72
  */
73
- height: number;
73
+ height: 数字;
74
74
  };
75
75
  /**
76
76
  * 获取屏幕缩放比例
@@ -63,7 +63,7 @@ declare namespace $输入法 {
63
63
  function 按回车键(): 布尔值;
64
64
  /**
65
65
  * 隐藏键盘
66
- * @returns {boolean} 如果成功返回 true,否则返回 false
66
+ * @returns 如果成功返回 true,否则返回 false
67
67
  * @example
68
68
  * if ($输入法.隐藏键盘()) {
69
69
  * $打印信息日志("键盘已隐藏")