ms-types 0.0.10 → 0.0.13
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 +8 -7
- package/types/action.d.ts +16 -10
- package/types/config.d.ts +8 -1
- package/types/device.d.ts +24 -8
- package/types/file.d.ts +22 -2
- package/types/global.d.ts +8 -0
- package/types/http.d.ts +30 -0
- package/types/image.d.ts +141 -6
- package/types/ime.d.ts +42 -2
- package/types/index.d.ts +1 -1
- package/types/logger.d.ts +20 -3
- package/types/media.d.ts +41 -0
- package/types/node.d.ts +6 -0
- package/types/{ocr.d.ts → paddleocr.d.ts} +16 -3
- package/types/system.d.ts +60 -5
- package/types/thread.d.ts +56 -10
- package/types/ui.d.ts +27 -2
- package/types/utils.d.ts +14 -7
- package/types/workerThread.d.ts +3 -2
- package/types/yolo.d.ts +53 -45
package/types/image.d.ts
CHANGED
|
@@ -1,40 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图片模块 包含图片操作、图片内容读写等功能
|
|
3
|
+
*/
|
|
1
4
|
declare namespace image {
|
|
2
5
|
/**
|
|
3
6
|
* 截图
|
|
4
7
|
* @returns 截图的imageId ,如果截图失败则返回null
|
|
8
|
+
* @example
|
|
9
|
+
* const imageId = image.captureFullScreen()
|
|
10
|
+
* if (imageId) {
|
|
11
|
+
* image.saveTo(imageId, "screen.png")
|
|
12
|
+
* }
|
|
5
13
|
*/
|
|
6
14
|
function captureFullScreen(): string | null;
|
|
7
15
|
/**
|
|
8
16
|
* 保存图片
|
|
9
17
|
* @param imageId 图片id 路径 http地址或者 screen 实时截屏
|
|
10
18
|
* @param filePath 保存路径
|
|
19
|
+
* @example
|
|
20
|
+
* image.saveTo(imageId, "screen.png")
|
|
11
21
|
*/
|
|
12
22
|
function saveTo(imageId: string, filePath: string): void;
|
|
13
23
|
/**
|
|
14
24
|
* 图片是否已释放
|
|
15
25
|
* @param imageId 图片id
|
|
16
26
|
* @returns true 已释放 false 未释放
|
|
27
|
+
* @example
|
|
28
|
+
* const imageId = image.captureFullScreen()
|
|
29
|
+
* if (imageId) {
|
|
30
|
+
* image.saveTo(imageId, "screen.png")
|
|
31
|
+
* image.isRelease(imageId) // false
|
|
32
|
+
* image.release(imageId)
|
|
33
|
+
* image.isRelease(imageId) // true
|
|
34
|
+
* }
|
|
17
35
|
*/
|
|
18
36
|
function isRelease(imageId: string): boolean;
|
|
19
37
|
/**
|
|
20
38
|
* 释放图片
|
|
21
39
|
* @param imageId 图片id
|
|
40
|
+
* @example
|
|
41
|
+
* image.release(imageId)
|
|
22
42
|
*/
|
|
23
43
|
function release(imageId: string): void;
|
|
24
44
|
/**
|
|
25
45
|
* 释放所有图片
|
|
46
|
+
* @example
|
|
47
|
+
* image.releaseAll()
|
|
26
48
|
*/
|
|
27
49
|
function releaseAll(): void;
|
|
28
50
|
/**
|
|
29
51
|
* 获取图片大小
|
|
30
52
|
* @param imageId 图片id
|
|
31
53
|
* @returns 图片大小 {width: number, height: number}
|
|
54
|
+
* @example
|
|
55
|
+
* const size = image.getSize(imageId)
|
|
56
|
+
* if (size) {
|
|
57
|
+
* console.log(size.width, size.height)
|
|
58
|
+
* }
|
|
32
59
|
*/
|
|
33
60
|
function getSize(imageId: string): { width: number; height: number } | null;
|
|
34
61
|
/**
|
|
35
62
|
* 读取图片
|
|
36
63
|
* @param path 图片路径
|
|
37
64
|
* @returns 图片id ,如果读取失败则返回null
|
|
65
|
+
* @example
|
|
66
|
+
* const imageId = image.readImage("screen.png")
|
|
67
|
+
* if (imageId) {
|
|
68
|
+
* image.saveTo(imageId, "screen.png")
|
|
69
|
+
* }
|
|
70
|
+
* image.release(imageId)
|
|
38
71
|
*/
|
|
39
72
|
function readImage(path: string): string | null;
|
|
40
73
|
/**
|
|
@@ -42,6 +75,15 @@ declare namespace image {
|
|
|
42
75
|
* @param imageId 图片id
|
|
43
76
|
* @param degree 旋转角度 只能是 90 -90 180
|
|
44
77
|
* @returns 旋转后的图片id ,如果旋转失败则返回null
|
|
78
|
+
* @example
|
|
79
|
+
* const imageId = image.readImage("screen.png")
|
|
80
|
+
* if (imageId) {
|
|
81
|
+
* const newImageId = image.rotateImage(imageId, 90)
|
|
82
|
+
* if (newImageId) {
|
|
83
|
+
* image.saveTo(newImageId, "screen.png")
|
|
84
|
+
* }
|
|
85
|
+
* image.release(imageId)
|
|
86
|
+
* }
|
|
45
87
|
*/
|
|
46
88
|
function rotateImage(imageId: string, degree: number): string | null;
|
|
47
89
|
/**
|
|
@@ -54,6 +96,14 @@ declare namespace image {
|
|
|
54
96
|
* @param ex 右下角x
|
|
55
97
|
* @param ey 右下角y
|
|
56
98
|
* @returns true 相同 false 不同
|
|
99
|
+
* @example
|
|
100
|
+
* const imageId = image.readImage("screen.png")
|
|
101
|
+
* if (imageId) {
|
|
102
|
+
* const isSame = image.cmpColor(imageId, "1|2|#6DD1E6-#101010", 10, 0, 0, 100, 100)
|
|
103
|
+
* if (isSame) {
|
|
104
|
+
* console.log("颜色相同")
|
|
105
|
+
* }
|
|
106
|
+
* }
|
|
57
107
|
*/
|
|
58
108
|
function cmpColor(
|
|
59
109
|
imageId: string,
|
|
@@ -76,6 +126,15 @@ declare namespace image {
|
|
|
76
126
|
* @param limit 限制数量
|
|
77
127
|
* @param orz 查找方向1-8
|
|
78
128
|
* @returns 颜色点数组
|
|
129
|
+
* @example
|
|
130
|
+
* const imageId = image.readImage("screen.png")
|
|
131
|
+
* if (imageId) {
|
|
132
|
+
* const points = image.findColor(imageId, "0x6DD1E6-0x101010", 10, 0, 0, 100, 100, 1, 1)
|
|
133
|
+
* if (points.length > 0) {
|
|
134
|
+
* console.log("找到颜色")
|
|
135
|
+
* }
|
|
136
|
+
* }
|
|
137
|
+
* image.release(imageId)
|
|
79
138
|
*/
|
|
80
139
|
function findColor(
|
|
81
140
|
imageId: string,
|
|
@@ -101,6 +160,15 @@ declare namespace image {
|
|
|
101
160
|
* @param limit 限制数量
|
|
102
161
|
* @param orz 查找方向1-8
|
|
103
162
|
* @returns 颜色点数组
|
|
163
|
+
* @example
|
|
164
|
+
* const imageId = image.readImage("screen.png")
|
|
165
|
+
* if (imageId) {
|
|
166
|
+
* const points = image.findMultiColor(imageId, "0x6DD1E6-0x101010", 10, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
|
|
167
|
+
* if (points.length > 0) {
|
|
168
|
+
* console.log("找到颜色")
|
|
169
|
+
* }
|
|
170
|
+
* }
|
|
171
|
+
* image.release(imageId)
|
|
104
172
|
*/
|
|
105
173
|
function findMultiColor(
|
|
106
174
|
imageId: string,
|
|
@@ -122,10 +190,23 @@ declare namespace image {
|
|
|
122
190
|
* @param y 左上角y
|
|
123
191
|
* @param ex 右下角x
|
|
124
192
|
* @param ey 右下角y
|
|
125
|
-
* @param
|
|
193
|
+
* @param threshold 阈值
|
|
126
194
|
* @param limit 限制数量
|
|
127
195
|
* @param method 方法
|
|
128
196
|
* @returns 图片数组
|
|
197
|
+
* @example
|
|
198
|
+
* const imageId = image.readImage("screen.png")
|
|
199
|
+
* if (imageId) {
|
|
200
|
+
* const templateImageId = image.readImage("template.png")
|
|
201
|
+
* if (templateImageId) {
|
|
202
|
+
* const points = image.findImage(imageId, templateImageId, 0, 0, 100, 100, 0.8, 1, 0)
|
|
203
|
+
* if (points.length > 0) {
|
|
204
|
+
* console.log("找到图片")
|
|
205
|
+
* }
|
|
206
|
+
* }
|
|
207
|
+
* image.release(templateImageId)
|
|
208
|
+
* }
|
|
209
|
+
* image.release(imageId)
|
|
129
210
|
*/
|
|
130
211
|
function findImage(
|
|
131
212
|
imageId: string,
|
|
@@ -134,7 +215,7 @@ declare namespace image {
|
|
|
134
215
|
y: number,
|
|
135
216
|
ex: number,
|
|
136
217
|
ey: number,
|
|
137
|
-
|
|
218
|
+
threshold: number,
|
|
138
219
|
limit: number,
|
|
139
220
|
method: number
|
|
140
221
|
): {
|
|
@@ -152,6 +233,15 @@ declare namespace image {
|
|
|
152
233
|
* @param ex 坐标ex
|
|
153
234
|
* @param ey 坐标ey
|
|
154
235
|
* @returns 裁剪后的图片id
|
|
236
|
+
* @example
|
|
237
|
+
* const imageId = image.readImage("screen.png")
|
|
238
|
+
* if (imageId) {
|
|
239
|
+
* const clipImageId = image.clip(imageId, 0, 0, 100, 100)
|
|
240
|
+
* if (clipImageId) {
|
|
241
|
+
* console.log("裁剪成功")
|
|
242
|
+
* }
|
|
243
|
+
* }
|
|
244
|
+
* image.release(imageId)
|
|
155
245
|
*/
|
|
156
246
|
function clip(
|
|
157
247
|
imageId: string,
|
|
@@ -166,6 +256,13 @@ declare namespace image {
|
|
|
166
256
|
* @param x 坐标x
|
|
167
257
|
* @param y 坐标y
|
|
168
258
|
* @returns 颜色值
|
|
259
|
+
* @example
|
|
260
|
+
* const imageId = image.readImage("screen.png")
|
|
261
|
+
* if (imageId) {
|
|
262
|
+
* const color = image.pixel(imageId, 0, 0)
|
|
263
|
+
* console.log(color)
|
|
264
|
+
* }
|
|
265
|
+
* image.release(imageId)
|
|
169
266
|
*/
|
|
170
267
|
function pixel(imageId: string, x: number, y: number): number;
|
|
171
268
|
/**
|
|
@@ -173,6 +270,13 @@ declare namespace image {
|
|
|
173
270
|
* @param imageId 图片id
|
|
174
271
|
* @param color 颜色值
|
|
175
272
|
* @returns 16进制RGB字符串
|
|
273
|
+
* @example
|
|
274
|
+
* const imageId = image.readImage("screen.png")
|
|
275
|
+
* if (imageId) {
|
|
276
|
+
* const color = image.pixel(imageId, 0, 0)
|
|
277
|
+
* console.log(image.argb(imageId, color))
|
|
278
|
+
* }
|
|
279
|
+
* image.release(imageId)
|
|
176
280
|
*/
|
|
177
281
|
function argb(imageId: string, color: number): string;
|
|
178
282
|
/**
|
|
@@ -180,26 +284,57 @@ declare namespace image {
|
|
|
180
284
|
* @param imageId 图片id
|
|
181
285
|
* @param threshold 阈值
|
|
182
286
|
* @returns 二值化后的图片id
|
|
287
|
+
* @example
|
|
288
|
+
* const imageId = image.readImage("screen.png")
|
|
289
|
+
* if (imageId) {
|
|
290
|
+
* const binaryzationImageId = image.binaryzation(imageId, 128)
|
|
291
|
+
* if (binaryzationImageId) {
|
|
292
|
+
* console.log("二值化成功")
|
|
293
|
+
* }
|
|
294
|
+
* }
|
|
295
|
+
* image.release(imageId)
|
|
183
296
|
*/
|
|
184
297
|
function binaryzation(imageId: string, threshold: number): string;
|
|
185
298
|
/**
|
|
186
299
|
* 灰度化
|
|
187
300
|
* @param imageId 图片id
|
|
188
301
|
* @returns 灰度化后的图片id
|
|
302
|
+
* @example
|
|
303
|
+
* const imageId = image.readImage("screen.png")
|
|
304
|
+
* if (imageId) {
|
|
305
|
+
* const grayImageId = image.gray(imageId)
|
|
306
|
+
* if (grayImageId) {
|
|
307
|
+
* console.log("灰度化成功")
|
|
308
|
+
* }
|
|
309
|
+
* }
|
|
310
|
+
* image.release(imageId)
|
|
189
311
|
*/
|
|
190
312
|
function gray(imageId: string): string;
|
|
191
313
|
/**
|
|
192
|
-
*
|
|
193
|
-
* @param
|
|
194
|
-
* @returns
|
|
314
|
+
* base64转图片
|
|
315
|
+
* @param base64 base64字符串
|
|
316
|
+
* @returns 图片id
|
|
317
|
+
* @example
|
|
318
|
+
* const imageId = image.base64ToImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg==")
|
|
319
|
+
* if (imageId) {
|
|
320
|
+
* console.log("base64转图片成功")
|
|
321
|
+
* }
|
|
322
|
+
* image.release(imageId)
|
|
195
323
|
*/
|
|
196
324
|
function base64ToImage(base64: string): string;
|
|
197
325
|
/**
|
|
198
326
|
* 图片转base64
|
|
199
327
|
* @param imageId 图片id
|
|
200
328
|
* @param format 格式
|
|
201
|
-
* @param q 质量
|
|
329
|
+
* @param q 质量 1-100 数字越大质量越高
|
|
202
330
|
* @returns base64字符串
|
|
331
|
+
* @example
|
|
332
|
+
* const imageId = image.readImage("screen.png")
|
|
333
|
+
* if (imageId) {
|
|
334
|
+
* const base64 = image.toBase64Format(imageId, "png", 100)
|
|
335
|
+
* console.log(base64)
|
|
336
|
+
* }
|
|
337
|
+
* image.release(imageId)
|
|
203
338
|
*/
|
|
204
339
|
function toBase64Format(imageId: string, format: string, q: number): string;
|
|
205
340
|
}
|
package/types/ime.d.ts
CHANGED
|
@@ -1,59 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 输入法模块 包含输入法操作、输入法内容读写等功能
|
|
3
|
+
*/
|
|
1
4
|
declare namespace ime {
|
|
2
5
|
/**
|
|
3
|
-
* 检查输入法是否正常工作
|
|
4
|
-
* @returns {boolean}
|
|
6
|
+
* 检查输入法是否正常工作 键盘是否已弹出
|
|
7
|
+
* @returns {boolean} 如果输入法键盘是否已弹出返回 true,否则返回 false
|
|
8
|
+
* @example
|
|
9
|
+
* if (ime.isOk()) {
|
|
10
|
+
* console.log("输入法已启动")
|
|
11
|
+
* }
|
|
5
12
|
*/
|
|
6
13
|
function isOk(): boolean;
|
|
7
14
|
/**
|
|
8
15
|
* 获取当前输入框的文本内容
|
|
9
16
|
* @returns {string} 当前输入框的完整文本
|
|
17
|
+
* @example
|
|
18
|
+
* const text = ime.getText()
|
|
19
|
+
* console.log(text)
|
|
10
20
|
*/
|
|
11
21
|
function getText(): string;
|
|
12
22
|
/**
|
|
13
23
|
* 清空当前输入框的文本内容
|
|
24
|
+
* @example
|
|
25
|
+
* ime.clearText()
|
|
14
26
|
*/
|
|
15
27
|
function clearText(): boolean;
|
|
16
28
|
/**
|
|
17
29
|
* 模拟输入文本
|
|
18
30
|
* @param {string} text 要输入的文本
|
|
19
31
|
* @returns {string} 输入后的文本内容 失败返回空字符串
|
|
32
|
+
* @example
|
|
33
|
+
* const text = ime.input("hello")
|
|
34
|
+
* console.log(text)
|
|
20
35
|
*/
|
|
21
36
|
function input(text: string): string;
|
|
22
37
|
/**
|
|
23
38
|
* 模拟粘贴文本
|
|
24
39
|
* @param {string} text 要粘贴的文本
|
|
25
40
|
* @returns {string} 粘贴后的文本内容 失败返回空字符串
|
|
41
|
+
* @example
|
|
42
|
+
* const text = ime.paste("hello")
|
|
43
|
+
* console.log(text)
|
|
26
44
|
*/
|
|
27
45
|
function paste(text: string): string;
|
|
28
46
|
/**
|
|
29
47
|
* 模拟删除键
|
|
30
48
|
* @returns {string} 如果为空,代表输入框无数据,如果不为空,代表输入框剩余数据
|
|
49
|
+
* @example
|
|
50
|
+
* const text = ime.pressDel()
|
|
51
|
+
* console.log(text)
|
|
31
52
|
*/
|
|
32
53
|
function pressDel(): string;
|
|
33
54
|
/**
|
|
34
55
|
* 模拟回车键
|
|
35
56
|
* @returns {boolean} 如果成功返回 true,否则返回 false
|
|
57
|
+
* @example
|
|
58
|
+
* if (ime.pressEnter()) {
|
|
59
|
+
* console.log("回车键按下")
|
|
60
|
+
* }
|
|
36
61
|
*/
|
|
37
62
|
function pressEnter(): boolean;
|
|
38
63
|
/**
|
|
39
64
|
* 隐藏键盘
|
|
40
65
|
* @returns {boolean} 如果成功返回 true,否则返回 false
|
|
66
|
+
* @example
|
|
67
|
+
* if (ime.dismiss()) {
|
|
68
|
+
* console.log("键盘已隐藏")
|
|
69
|
+
* }
|
|
41
70
|
*/
|
|
42
71
|
function dismiss(): boolean;
|
|
43
72
|
/**
|
|
44
73
|
* 获取剪贴板内容
|
|
45
74
|
* @returns {string} 剪贴板内容
|
|
75
|
+
* @example
|
|
76
|
+
* const text = ime.getClipboard()
|
|
77
|
+
* console.log(text)
|
|
46
78
|
*/
|
|
47
79
|
function getClipboard(): string;
|
|
48
80
|
/**
|
|
49
81
|
* 设置剪贴板内容
|
|
50
82
|
* @param {string} text 要设置的剪贴板内容 键盘显示时才能设置
|
|
51
83
|
* @returns {boolean} 如果成功返回 true,否则返回 false
|
|
84
|
+
* @example
|
|
85
|
+
* if (ime.setClipboard("hello")) {
|
|
86
|
+
* console.log("剪贴板内容已设置")
|
|
87
|
+
* }
|
|
52
88
|
*/
|
|
53
89
|
function setClipboard(text: string): boolean;
|
|
54
90
|
/**
|
|
55
91
|
* 切换键盘
|
|
56
92
|
* @returns {boolean} 如果成功返回 true,否则返回 false
|
|
93
|
+
* @example
|
|
94
|
+
* if (ime.switchKeyboard()) {
|
|
95
|
+
* console.log("键盘已切换")
|
|
96
|
+
* }
|
|
57
97
|
*/
|
|
58
98
|
function switchKeyboard(): boolean;
|
|
59
99
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/// <reference path="ime.d.ts" />
|
|
9
9
|
/// <reference path="logger.d.ts" />
|
|
10
10
|
/// <reference path="media.d.ts" />
|
|
11
|
-
/// <reference path="
|
|
11
|
+
/// <reference path="paddleocr.d.ts" />
|
|
12
12
|
/// <reference path="system.d.ts" />
|
|
13
13
|
/// <reference path="thread.d.ts" />
|
|
14
14
|
/// <reference path="ui.d.ts" />
|
package/types/logger.d.ts
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 日志模块 包含日志输出、日志等级设置等功能
|
|
3
|
+
*/
|
|
1
4
|
declare namespace logger {
|
|
2
5
|
/**
|
|
3
|
-
* 设置日志等级
|
|
6
|
+
* 设置日志等级 开发环境默认debug 打包后默认info 可选值error、warn、debug、info、off
|
|
4
7
|
* @param level 日志等级
|
|
8
|
+
* @example
|
|
9
|
+
* logger.setLoggerLevel("info");
|
|
5
10
|
*/
|
|
6
11
|
function setLoggerLevel(
|
|
7
12
|
level: "error" | "warn" | "debug" | "info" | "off"
|
|
8
13
|
): void;
|
|
9
14
|
/**
|
|
10
|
-
* 设置是否输出到文件
|
|
15
|
+
* 设置是否输出到文件 默认开启
|
|
11
16
|
* @param enabled 是否输出到文件
|
|
17
|
+
* @example
|
|
18
|
+
* logger.setLogToFile(true);
|
|
12
19
|
*/
|
|
13
20
|
function setLogToFile(enabled: boolean): void;
|
|
14
21
|
/**
|
|
15
|
-
* 重置日志文件
|
|
22
|
+
* 重置日志文件 会创建一个新的日志文件 避免一个日志文件太大
|
|
23
|
+
* @example
|
|
24
|
+
* logger.resetLogFile();
|
|
16
25
|
*/
|
|
17
26
|
function resetLogFile(): void;
|
|
18
27
|
/**
|
|
19
28
|
* 调试日志
|
|
20
29
|
* @param log 日志内容
|
|
30
|
+
* @example
|
|
31
|
+
* logger.debug("调试日志");
|
|
21
32
|
*/
|
|
22
33
|
function debug(log: string): void;
|
|
23
34
|
/**
|
|
24
35
|
* 信息日志
|
|
25
36
|
* @param log 日志内容
|
|
37
|
+
* @example
|
|
38
|
+
* logger.info("信息日志");
|
|
26
39
|
*/
|
|
27
40
|
function info(log: string): void;
|
|
28
41
|
/**
|
|
29
42
|
* 警告日志
|
|
30
43
|
* @param log 日志内容
|
|
44
|
+
* @example
|
|
45
|
+
* logger.warn("警告日志");
|
|
31
46
|
*/
|
|
32
47
|
function warn(log: string): void;
|
|
33
48
|
/**
|
|
34
49
|
* 错误日志
|
|
35
50
|
* @param log 日志内容
|
|
51
|
+
* @example
|
|
52
|
+
* logger.error("错误日志");
|
|
36
53
|
*/
|
|
37
54
|
function error(log: string): void;
|
|
38
55
|
}
|
package/types/media.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 媒体模块 包含媒体操作、媒体内容读写等功能
|
|
3
|
+
*/
|
|
1
4
|
declare namespace media {
|
|
2
5
|
/**
|
|
3
6
|
* 保存图像到相册
|
|
4
7
|
* @param img 图像ID
|
|
5
8
|
* @returns 是否保存成功
|
|
9
|
+
* @example
|
|
10
|
+
* const imageId = image.readImage("screen.png")
|
|
11
|
+
* if (imageId) {
|
|
12
|
+
* const saved = media.saveImageToAlbum(imageId)
|
|
13
|
+
* if (saved) {
|
|
14
|
+
* console.log("保存成功")
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
6
17
|
*/
|
|
7
18
|
function saveImageToAlbum(img: string): boolean;
|
|
8
19
|
|
|
@@ -10,18 +21,33 @@ declare namespace media {
|
|
|
10
21
|
* 保存视频路径到相册
|
|
11
22
|
* @param path 视频文件的路径
|
|
12
23
|
* @returns 是否保存成功
|
|
24
|
+
* @example
|
|
25
|
+
* const saved = media.saveVideoToAlbumPath("video.mp4")
|
|
26
|
+
* if (saved) {
|
|
27
|
+
* console.log("保存成功")
|
|
28
|
+
* }
|
|
13
29
|
*/
|
|
14
30
|
function saveVideoToAlbumPath(path: string): boolean;
|
|
15
31
|
|
|
16
32
|
/**
|
|
17
33
|
* 清空相册中的图片
|
|
18
34
|
* @returns 是否删除成功
|
|
35
|
+
* @example
|
|
36
|
+
* const deleted = media.deleteAllPhotos()
|
|
37
|
+
* if (deleted) {
|
|
38
|
+
* console.log("删除成功")
|
|
39
|
+
* }
|
|
19
40
|
*/
|
|
20
41
|
function deleteAllPhotos(): boolean;
|
|
21
42
|
|
|
22
43
|
/**
|
|
23
44
|
* 清空相册中的视频
|
|
24
45
|
* @returns 是否删除成功
|
|
46
|
+
* @example
|
|
47
|
+
* const deleted = media.deleteAllVideos()
|
|
48
|
+
* if (deleted) {
|
|
49
|
+
* console.log("删除成功")
|
|
50
|
+
* }
|
|
25
51
|
*/
|
|
26
52
|
function deleteAllVideos(): boolean;
|
|
27
53
|
|
|
@@ -30,12 +56,22 @@ declare namespace media {
|
|
|
30
56
|
* @param path 文件路径
|
|
31
57
|
* @param loop 是否循环播放
|
|
32
58
|
* @returns 是否播放成功
|
|
59
|
+
* @example
|
|
60
|
+
* const played = media.playMp3("music.mp3", true)
|
|
61
|
+
* if (played) {
|
|
62
|
+
* console.log("播放成功")
|
|
63
|
+
* }
|
|
33
64
|
*/
|
|
34
65
|
function playMp3(path: string, loop: boolean): boolean;
|
|
35
66
|
|
|
36
67
|
/**
|
|
37
68
|
* 停止播放mp3音乐
|
|
38
69
|
* @returns 是否停止成功
|
|
70
|
+
* @example
|
|
71
|
+
* const stopped = media.stopMp3()
|
|
72
|
+
* if (stopped) {
|
|
73
|
+
* console.log("停止成功")
|
|
74
|
+
* }
|
|
39
75
|
*/
|
|
40
76
|
function stopMp3(): boolean;
|
|
41
77
|
|
|
@@ -44,6 +80,11 @@ declare namespace media {
|
|
|
44
80
|
* @param path 文件路径
|
|
45
81
|
* @param loop 是否循环播放
|
|
46
82
|
* @returns 是否播放成功
|
|
83
|
+
* @example
|
|
84
|
+
* const played = media.playMp3WaitEnd("music.mp3", true)
|
|
85
|
+
* if (played) {
|
|
86
|
+
* console.log("播放成功")
|
|
87
|
+
* }
|
|
47
88
|
*/
|
|
48
89
|
function playMp3WaitEnd(path: string, loop: boolean): boolean;
|
|
49
90
|
}
|
package/types/node.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 节点模块 包含节点操作、节点内容读写等功能
|
|
3
|
+
*/
|
|
1
4
|
declare function createNodeSelector(params: {
|
|
2
5
|
/**
|
|
3
6
|
* 1 代表不管visible是true还是false都获取,2 代表只获取 visible=true的节点
|
|
@@ -137,6 +140,9 @@ declare interface NodeInfo {
|
|
|
137
140
|
nextSiblings(): NodeInfo[];
|
|
138
141
|
}
|
|
139
142
|
|
|
143
|
+
/**
|
|
144
|
+
* 节点选择器 包含节点选择、节点操作等功能
|
|
145
|
+
*/
|
|
140
146
|
declare class NodeSelector {
|
|
141
147
|
/**
|
|
142
148
|
* 获取节点信息
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 飞桨OCR模块 包含OCR识别、OCR模型加载等功能
|
|
3
|
+
*/
|
|
4
|
+
declare namespace paddleocr {
|
|
2
5
|
/**
|
|
3
|
-
* 初始化
|
|
6
|
+
* 初始化PP-OCRv5模型
|
|
4
7
|
* @param useGpu 是否使用GPU,默认false
|
|
5
8
|
* @returns 初始化是否成功
|
|
9
|
+
* @example
|
|
10
|
+
* const loaded = paddleocr.loadV5(true)
|
|
11
|
+
* if (loaded) {
|
|
12
|
+
* console.log("加载成功")
|
|
13
|
+
* }
|
|
6
14
|
*/
|
|
7
|
-
function
|
|
15
|
+
function loadV5(useGpu: boolean): boolean;
|
|
8
16
|
/**
|
|
9
17
|
* 执行OCR识别
|
|
10
18
|
* @param input 输入源(imageId、URL字符串、文件路径或"screen",nil表示使用当前屏幕)
|
|
@@ -13,6 +21,11 @@ declare namespace ocr {
|
|
|
13
21
|
* @param ex 边界框右下角x坐标
|
|
14
22
|
* @param ey 边界框右下角y坐标
|
|
15
23
|
* @returns 识别结果数组
|
|
24
|
+
* @example
|
|
25
|
+
* const results = paddleocr.recognize("screen", 0, 0, 100, 100)
|
|
26
|
+
* if (results.length > 0) {
|
|
27
|
+
* console.log("识别到文本")
|
|
28
|
+
* }
|
|
16
29
|
*/
|
|
17
30
|
function recognize(
|
|
18
31
|
input: string | null,
|