ms-types 0.0.55 → 0.0.57

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/types/global.d.ts CHANGED
@@ -1,164 +1,164 @@
1
- /**
2
- * 是否是调试模式
3
- */
4
- declare const __debug__: boolean;
5
- /**
6
- * 是否应该退出应用
7
- */
8
- declare const __shouldExit__: boolean;
9
- /**
10
- * 应用版本
11
- */
12
- declare const __appVersion__: string;
13
- /**
14
- * 应用构建号
15
- */
16
- declare const __appBuildNumber__: string;
17
- /**
18
- * 应用名称
19
- */
20
- declare const __appName__: string;
21
- /**
22
- * 应用 bundleId
23
- */
24
- declare const __bundleId__: string;
25
- /**
26
- * 当前线程名称
27
- */
28
- declare const __threadName__: string;
29
- /**
30
- * 应用包信息
31
- */
32
- declare const __package__: {
33
- /**
34
- * 应用名称
35
- */
36
- name: string;
37
- /**
38
- * 应用版本
39
- */
40
- appVersion: string;
41
- /**
42
- * 应用 Id
43
- */
44
- appId: string;
45
- /**
46
- * 应用更新参数
47
- */
48
- update: {
49
- /**
50
- * 应用更新地址
51
- */
52
- url: string;
53
- /**
54
- * 应用更新超时时间
55
- */
56
- timeout: number;
57
- };
58
- [key: string]: any;
59
- };
60
-
61
- /**
62
- * 设置停止回调(仅主线程调用)
63
- * @param callback 停止回调
64
- * @description 脚本执行完成或异常停止时调用,exit 退出不会触发
65
- * @example
66
- * setStopCallback(() => {
67
- * logi("脚本执行完成");
68
- * });
69
- */
70
- declare function setStopCallback(callback: () => void): void;
71
-
72
- /**
73
- * 设置异常停止回调(仅主线程调用)
74
- * @param callback 异常停止回调
75
- * @description 脚本执行异常停止时调用
76
- * @example
77
- * setExceptionCallback(() => {
78
- * loge("脚本执行异常");
79
- * });
80
- */
81
- declare function setExceptionCallback(callback: () => void): void;
82
-
83
- /**
84
- * 重启脚本(仅主线程调用)
85
- * @param delay 延迟时间 毫秒
86
- * @description 重启脚本会延迟指定时间后再重启,不要低于 2000 毫秒
87
- * @example
88
- * setExceptionCallback(() => {
89
- * restartScript(2000);
90
- * });
91
- */
92
- declare function restartScript(delay: number): void;
93
-
94
- /**
95
- * 线程睡眠
96
- * @param ms 毫秒
97
- * @description 线程睡眠会阻塞当前线程,等待指定时间后继续执行
98
- * @example
99
- * sleep(1000);
100
- */
101
- declare function sleep(ms: number): void;
102
- /**
103
- * 退出应用
104
- * @param exitAll 是否退出所有线程 true 退出所有 false 退出当前线程,不传默认 false
105
- * @description 退出应用会终止所有线程的执行
106
- * @example
107
- * exit();
108
- */
109
- declare function exit(exitAll?: boolean): void;
110
- /**
111
- * 获取当前时间戳
112
- * @returns 时间戳
113
- * @example
114
- * const timestamp = time();
115
- */
116
- declare function time(): number;
117
- /**
118
- * 把 app 切换到前台 utils.takeMeToFront 的别名
119
- * @see utils.takeMeToFront
120
- * @description 把 app 切换到前台
121
- * @example
122
- * takeMeToFront();
123
- */
124
- declare function takeMeToFront(): void;
125
- /**
126
- * 日志调试 - 输出调试级别的日志
127
- * 用于详细的程序执行信息、变量值和状态信息、函数调用跟踪
128
- * @param args 日志消息内容
129
- * @see logger.debug
130
- * @example
131
- * logd("程序开始执行");
132
- * logd(`当前用户: ${username}`);
133
- */
134
- declare function logd(...args: any[]): void;
135
- /**
136
- * 日志信息 - 输出信息级别的日志
137
- * 用于程序正常运行信息、重要操作的确认、状态变更通知
138
- * @param args 日志消息内容
139
- * @see logger.info
140
- * @example
141
- * logi("应用程序启动成功");
142
- * logi("用户登录成功");
143
- */
144
- declare function logi(...args: any[]): void;
145
- /**
146
- * 日志警告 - 输出警告级别的日志
147
- * 用于潜在的问题、不推荐的操作、性能警告、兼容性问题
148
- * @param args 日志消息内容
149
- * @see logger.warn
150
- * @example
151
- * logw("电池电量低于 20%");
152
- * logw("网络连接不稳定");
153
- */
154
- declare function logw(...args: any[]): void;
155
- /**
156
- * 日志错误 - 输出错误级别的日志
157
- * 用于程序错误和异常、操作失败、系统错误、致命问题
158
- * @param args 日志消息内容
159
- * @see logger.error
160
- * @example
161
- * loge("网络请求失败");
162
- * loge("文件读取错误");
163
- */
164
- declare function loge(...args: any[]): void;
1
+ /**
2
+ * 是否是调试模式
3
+ */
4
+ declare const __debug__: boolean;
5
+ /**
6
+ * 是否应该退出应用
7
+ */
8
+ declare const __shouldExit__: boolean;
9
+ /**
10
+ * 应用版本
11
+ */
12
+ declare const __appVersion__: string;
13
+ /**
14
+ * 应用构建号
15
+ */
16
+ declare const __appBuildNumber__: string;
17
+ /**
18
+ * 应用名称
19
+ */
20
+ declare const __appName__: string;
21
+ /**
22
+ * 应用 bundleId
23
+ */
24
+ declare const __bundleId__: string;
25
+ /**
26
+ * 当前线程名称
27
+ */
28
+ declare const __threadName__: string;
29
+ /**
30
+ * 应用包信息
31
+ */
32
+ declare const __package__: {
33
+ /**
34
+ * 应用名称
35
+ */
36
+ name: string;
37
+ /**
38
+ * 应用版本
39
+ */
40
+ appVersion: string;
41
+ /**
42
+ * 应用 Id
43
+ */
44
+ appId: string;
45
+ /**
46
+ * 应用更新参数
47
+ */
48
+ update: {
49
+ /**
50
+ * 应用更新地址
51
+ */
52
+ url: string;
53
+ /**
54
+ * 应用更新超时时间
55
+ */
56
+ timeout: number;
57
+ };
58
+ [key: string]: any;
59
+ };
60
+
61
+ /**
62
+ * 设置停止回调(仅主线程调用)
63
+ * @param callback 停止回调
64
+ * @description 脚本执行完成或异常停止时调用,exit 退出不会触发
65
+ * @example
66
+ * setStopCallback(() => {
67
+ * logi("脚本执行完成");
68
+ * });
69
+ */
70
+ declare function setStopCallback(callback: () => void): void;
71
+
72
+ /**
73
+ * 设置异常停止回调(仅主线程调用)
74
+ * @param callback 异常停止回调
75
+ * @description 脚本执行异常停止时调用
76
+ * @example
77
+ * setExceptionCallback(() => {
78
+ * loge("脚本执行异常");
79
+ * });
80
+ */
81
+ declare function setExceptionCallback(callback: () => void): void;
82
+
83
+ /**
84
+ * 重启脚本(仅主线程调用)
85
+ * @param delay 延迟时间 毫秒
86
+ * @description 重启脚本会延迟指定时间后再重启,不要低于 2000 毫秒
87
+ * @example
88
+ * setExceptionCallback(() => {
89
+ * restartScript(2000);
90
+ * });
91
+ */
92
+ declare function restartScript(delay: number): void;
93
+
94
+ /**
95
+ * 线程睡眠
96
+ * @param ms 毫秒
97
+ * @description 线程睡眠会阻塞当前线程,等待指定时间后继续执行
98
+ * @example
99
+ * sleep(1000);
100
+ */
101
+ declare function sleep(ms: number): void;
102
+ /**
103
+ * 退出应用
104
+ * @param exitAll 是否退出所有线程 true 退出所有 false 退出当前线程,不传默认 false
105
+ * @description 退出应用会终止所有线程的执行
106
+ * @example
107
+ * exit();
108
+ */
109
+ declare function exit(exitAll?: boolean): void;
110
+ /**
111
+ * 获取当前时间戳
112
+ * @returns 时间戳
113
+ * @example
114
+ * const timestamp = time();
115
+ */
116
+ declare function time(): number;
117
+ /**
118
+ * 把 app 切换到前台 utils.takeMeToFront 的别名
119
+ * @see utils.takeMeToFront
120
+ * @description 把 app 切换到前台
121
+ * @example
122
+ * takeMeToFront();
123
+ */
124
+ declare function takeMeToFront(): void;
125
+ /**
126
+ * 日志调试 - 输出调试级别的日志
127
+ * 用于详细的程序执行信息、变量值和状态信息、函数调用跟踪
128
+ * @param args 日志消息内容
129
+ * @see logger.debug
130
+ * @example
131
+ * logd("程序开始执行");
132
+ * logd(`当前用户: ${username}`);
133
+ */
134
+ declare function logd(...args: any[]): void;
135
+ /**
136
+ * 日志信息 - 输出信息级别的日志
137
+ * 用于程序正常运行信息、重要操作的确认、状态变更通知
138
+ * @param args 日志消息内容
139
+ * @see logger.info
140
+ * @example
141
+ * logi("应用程序启动成功");
142
+ * logi("用户登录成功");
143
+ */
144
+ declare function logi(...args: any[]): void;
145
+ /**
146
+ * 日志警告 - 输出警告级别的日志
147
+ * 用于潜在的问题、不推荐的操作、性能警告、兼容性问题
148
+ * @param args 日志消息内容
149
+ * @see logger.warn
150
+ * @example
151
+ * logw("电池电量低于 20%");
152
+ * logw("网络连接不稳定");
153
+ */
154
+ declare function logw(...args: any[]): void;
155
+ /**
156
+ * 日志错误 - 输出错误级别的日志
157
+ * 用于程序错误和异常、操作失败、系统错误、致命问题
158
+ * @param args 日志消息内容
159
+ * @see logger.error
160
+ * @example
161
+ * loge("网络请求失败");
162
+ * loge("文件读取错误");
163
+ */
164
+ declare function loge(...args: any[]): void;
package/types/image.d.ts CHANGED
@@ -8,7 +8,7 @@ declare namespace image {
8
8
  * @example
9
9
  * const imageId = image.captureFullScreen()
10
10
  * if (imageId) {
11
- * image.saveTo(imageId, "screen.png")
11
+ * image.saveTo(imageId, "screen.jpg")
12
12
  * }
13
13
  */
14
14
  function captureFullScreen(): string | null;
@@ -17,7 +17,7 @@ declare namespace image {
17
17
  * @param imageId 图片id 路径 http地址或者 screen 实时截屏
18
18
  * @param filePath 保存路径
19
19
  * @example
20
- * image.saveTo(imageId, "screen.png")
20
+ * image.saveTo(imageId, "screen.jpg")
21
21
  */
22
22
  function saveTo(imageId: string, filePath: string): void;
23
23
  /**
@@ -27,7 +27,7 @@ declare namespace image {
27
27
  * @example
28
28
  * const imageId = image.captureFullScreen()
29
29
  * if (imageId) {
30
- * image.saveTo(imageId, "screen.png")
30
+ * image.saveTo(imageId, "screen.jpg")
31
31
  * image.isRelease(imageId) // false
32
32
  * image.release(imageId)
33
33
  * image.isRelease(imageId) // true
@@ -63,9 +63,9 @@ declare namespace image {
63
63
  * @param path 图片路径
64
64
  * @returns 图片id ,如果读取失败则返回null
65
65
  * @example
66
- * const imageId = image.readImage("screen.png")
66
+ * const imageId = image.readImage("screen.jpg")
67
67
  * if (imageId) {
68
- * image.saveTo(imageId, "screen.png")
68
+ * image.saveTo(imageId, "screen.jpg")
69
69
  * }
70
70
  * image.release(imageId)
71
71
  */
@@ -75,7 +75,7 @@ declare namespace image {
75
75
  * @param fileName 文件名
76
76
  * @returns 图片id ,如果读取失败则返回null
77
77
  * @example
78
- * image.readResImage("test.png")
78
+ * image.readResImage("test.jpg")
79
79
  */
80
80
  function readResImage(fileName: string): string | null;
81
81
  /**
@@ -84,11 +84,11 @@ declare namespace image {
84
84
  * @param degree 旋转角度 只能是 90 -90 180
85
85
  * @returns 旋转后的图片id ,如果旋转失败则返回null
86
86
  * @example
87
- * const imageId = image.readImage("screen.png")
87
+ * const imageId = image.readImage("screen.jpg")
88
88
  * if (imageId) {
89
89
  * const newImageId = image.rotateImage(imageId, 90)
90
90
  * if (newImageId) {
91
- * image.saveTo(newImageId, "screen.png")
91
+ * image.saveTo(newImageId, "screen.jpg")
92
92
  * }
93
93
  * image.release(imageId)
94
94
  * }
@@ -99,13 +99,13 @@ declare namespace image {
99
99
  * @param imageId 图片id
100
100
  * @param points 颜色点
101
101
  * @param threshold 阈值
102
- * @param x 左上角x
103
- * @param y 左上角y
104
- * @param ex 右下角x
105
- * @param ey 右下角y
102
+ * @param x 左上角x 全屏传0
103
+ * @param y 左上角y 全屏传0
104
+ * @param ex 右下角x 全屏传0
105
+ * @param ey 右下角y 全屏传0
106
106
  * @returns true 相同 false 不同
107
107
  * @example
108
- * const imageId = image.readImage("screen.png")
108
+ * const imageId = image.readImage("screen.jpg")
109
109
  * if (imageId) {
110
110
  * const isSame = image.cmpColor(imageId, "1|2|#6DD1E6-#101010", 10, 0, 0, 100, 100)
111
111
  * if (isSame) {
@@ -127,15 +127,15 @@ declare namespace image {
127
127
  * @param imageId 图片id
128
128
  * @param color 颜色 支持"主色-偏色"格式,如"0x6DD1E6-0x101010"
129
129
  * @param threshold 阈值
130
- * @param x 左上角x
131
- * @param y 左上角y
132
- * @param ex 右下角x
133
- * @param ey 右下角y
130
+ * @param x 左上角x 全屏传0
131
+ * @param y 左上角y 全屏传0
132
+ * @param ex 右下角x 全屏传0
133
+ * @param ey 右下角y 全屏传0
134
134
  * @param limit 限制数量
135
135
  * @param orz 查找方向1-8
136
136
  * @returns 颜色点数组
137
137
  * @example
138
- * const imageId = image.readImage("screen.png")
138
+ * const imageId = image.readImage("screen.jpg")
139
139
  * if (imageId) {
140
140
  * const points = image.findColor(imageId, "0x6DD1E6-0x101010", 10, 0, 0, 100, 100, 1, 1)
141
141
  * if (points.length > 0) {
@@ -161,15 +161,15 @@ declare namespace image {
161
161
  * @param firstColor 第一个颜色
162
162
  * @param threshold 阈值
163
163
  * @param points 颜色点
164
- * @param x 左上角x
165
- * @param y 左上角y
166
- * @param ex 右下角x
167
- * @param ey 右下角y
164
+ * @param x 左上角x 全屏传0
165
+ * @param y 左上角y 全屏传0
166
+ * @param ex 右下角x 全屏传0
167
+ * @param ey 右下角y 全屏传0
168
168
  * @param limit 限制数量
169
169
  * @param orz 查找方向1-8
170
170
  * @returns 颜色点数组
171
171
  * @example
172
- * const imageId = image.readImage("screen.png")
172
+ * const imageId = image.readImage("screen.jpg")
173
173
  * if (imageId) {
174
174
  * const points = image.findMultiColor(imageId, "0x6DD1E6-0x101010", 10, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
175
175
  * if (points.length > 0) {
@@ -194,16 +194,16 @@ declare namespace image {
194
194
  * 查找图片
195
195
  * @param imageId 图片id
196
196
  * @param templateImageId 模板图片id
197
- * @param x 左上角x
198
- * @param y 左上角y
199
- * @param ex 右下角x
200
- * @param ey 右下角y
197
+ * @param x 左上角x 全屏传0
198
+ * @param y 左上角y 全屏传0
199
+ * @param ex 右下角x 全屏传0
200
+ * @param ey 右下角y 全屏传0
201
201
  * @param threshold 阈值
202
202
  * @param limit 限制数量
203
203
  * @param method 方法
204
204
  * @returns 图片数组
205
205
  * @example
206
- * const points = image.findImage("screen", "template.png", 0, 0, 100, 100, 0.8, 1, 5)
206
+ * const points = image.findImage("screen", "template.jpg", 0, 0, 100, 100, 0.8, 1, 5)
207
207
  * if (points.length > 0) {
208
208
  * logger.info("找到图片")
209
209
  * }
@@ -238,7 +238,7 @@ declare namespace image {
238
238
  * @param ey 坐标ey
239
239
  * @returns 裁剪后的图片id
240
240
  * @example
241
- * const imageId = image.readImage("screen.png")
241
+ * const imageId = image.readImage("screen.jpg")
242
242
  * if (imageId) {
243
243
  * const clipImageId = image.clip(imageId, 0, 0, 100, 100)
244
244
  * if (clipImageId) {
@@ -261,7 +261,7 @@ declare namespace image {
261
261
  * @param y 坐标y
262
262
  * @returns 颜色值
263
263
  * @example
264
- * const imageId = image.readImage("screen.png")
264
+ * const imageId = image.readImage("screen.jpg")
265
265
  * if (imageId) {
266
266
  * const color = image.pixel(imageId, 0, 0)
267
267
  * logger.info(color)
@@ -275,7 +275,7 @@ declare namespace image {
275
275
  * @param color 颜色值
276
276
  * @returns 16进制RGB字符串
277
277
  * @example
278
- * const imageId = image.readImage("screen.png")
278
+ * const imageId = image.readImage("screen.jpg")
279
279
  * if (imageId) {
280
280
  * const color = image.pixel(imageId, 0, 0)
281
281
  * logger.info(image.argb(imageId, color))
@@ -289,7 +289,7 @@ declare namespace image {
289
289
  * @param threshold 阈值
290
290
  * @returns 二值化后的图片id
291
291
  * @example
292
- * const imageId = image.readImage("screen.png")
292
+ * const imageId = image.readImage("screen.jpg")
293
293
  * if (imageId) {
294
294
  * const binaryzationImageId = image.binaryzation(imageId, 128)
295
295
  * if (binaryzationImageId) {
@@ -304,7 +304,7 @@ declare namespace image {
304
304
  * @param imageId 图片id
305
305
  * @returns 灰度化后的图片id
306
306
  * @example
307
- * const imageId = image.readImage("screen.png")
307
+ * const imageId = image.readImage("screen.jpg")
308
308
  * if (imageId) {
309
309
  * const grayImageId = image.gray(imageId)
310
310
  * if (grayImageId) {
@@ -319,7 +319,7 @@ declare namespace image {
319
319
  * @param base64 base64字符串
320
320
  * @returns 图片id
321
321
  * @example
322
- * const imageId = image.base64ToImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==")
322
+ * const imageId = image.base64ToImage("data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==")
323
323
  * if (imageId) {
324
324
  * logger.info("base64转图片成功")
325
325
  * }
@@ -333,9 +333,9 @@ declare namespace image {
333
333
  * @param q 质量 1-100 数字越大质量越高
334
334
  * @returns base64字符串
335
335
  * @example
336
- * const imageId = image.readImage("screen.png")
336
+ * const imageId = image.readImage("screen.jpg")
337
337
  * if (imageId) {
338
- * const base64 = image.toBase64Format(imageId, "png", 100)
338
+ * const base64 = image.toBase64Format(imageId, "jpg", 100)
339
339
  * logger.info(base64)
340
340
  * }
341
341
  * image.release(imageId)
@@ -353,7 +353,7 @@ declare namespace image {
353
353
  * @param thickness 线宽
354
354
  * @returns 无
355
355
  * @example
356
- * const imageId = image.readImage("screen.png")
356
+ * const imageId = image.readImage("screen.jpg")
357
357
  * if (imageId) {
358
358
  * image.drawRect(imageId, 0, 0, 100, 100, "#ff0000", 1)
359
359
  * }
package/types/index.d.ts CHANGED
@@ -1,23 +1,24 @@
1
- /// <reference path="action.d.ts" />
2
- /// <reference path="appleOcr.d.ts" />
3
- /// <reference path="config.d.ts" />
4
- /// <reference path="device.d.ts" />
5
- /// <reference path="file.d.ts" />
6
- /// <reference path="global.d.ts" />
7
- /// <reference path="hotUpdate.d.ts" />
8
- /// <reference path="http.d.ts" />
9
- /// <reference path="image.d.ts" />
10
- /// <reference path="ime.d.ts" />
11
- /// <reference path="logger.d.ts" />
12
- /// <reference path="media.d.ts" />
13
- /// <reference path="mysql.d.ts" />
14
- /// <reference path="netCard.d.ts" />
15
- /// <reference path="node.d.ts" />
16
- /// <reference path="paddleOcr.d.ts" />
17
- /// <reference path="pip.d.ts" />
18
- /// <reference path="system.d.ts" />
19
- /// <reference path="thread.d.ts" />
20
- /// <reference path="tomatoOcr.d.ts" />
21
- /// <reference path="ui.d.ts" />
22
- /// <reference path="utils.d.ts" />
23
- /// <reference path="yolo.d.ts" />
1
+ /// <reference path="action.d.ts" />
2
+ /// <reference path="appleOcr.d.ts" />
3
+ /// <reference path="config.d.ts" />
4
+ /// <reference path="device.d.ts" />
5
+ /// <reference path="file.d.ts" />
6
+ /// <reference path="global.d.ts" />
7
+ /// <reference path="hotUpdate.d.ts" />
8
+ /// <reference path="http.d.ts" />
9
+ /// <reference path="image.d.ts" />
10
+ /// <reference path="ime.d.ts" />
11
+ /// <reference path="logger.d.ts" />
12
+ /// <reference path="media.d.ts" />
13
+ /// <reference path="mysql.d.ts" />
14
+ /// <reference path="netCard.d.ts" />
15
+ /// <reference path="node.d.ts" />
16
+ /// <reference path="paddleOcr.d.ts" />
17
+ /// <reference path="pip.d.ts" />
18
+ /// <reference path="system.d.ts" />
19
+ /// <reference path="thread.d.ts" />
20
+ /// <reference path="tomatoOcr.d.ts" />
21
+ /// <reference path="tts.d.ts" />
22
+ /// <reference path="ui.d.ts" />
23
+ /// <reference path="utils.d.ts" />
24
+ /// <reference path="yolo.d.ts" />