ms-types 0.10.17 → 0.10.18
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 +1 -1
- package/types/ai.d.ts +16 -16
- package/types/config.d.ts +1 -1
- package/types/dotocr.d.ts +2 -2
- package/types/file.d.ts +12 -12
- package/types/hid.d.ts +1 -1
- package/types/hotUpdate.d.ts +2 -2
- package/types/http.d.ts +4 -4
- package/types/image.d.ts +13 -13
- package/types/index.d.ts +4 -0
- package/types/jbclear.d.ts +12 -12
- package/types/jbdevice.d.ts +25 -25
- package/types/jbdraw.d.ts +83 -0
- package/types/jbdylib.d.ts +5 -5
- package/types/jbpower.d.ts +51 -0
- package/types/jbshell.d.ts +2 -2
- package/types/jbsystem.d.ts +6 -6
- package/types/jbvpn.d.ts +8 -8
- package/types/lua/jbdraw.lua +47 -0
- package/types/lua/jbpower.lua +37 -0
- package/types/lua/netcard.lua +0 -15
- package/types/lua/sqlite.lua +87 -0
- package/types/lua/zipFile.lua +33 -0
- package/types/mysql.d.ts +4 -4
- package/types/netCard.d.ts +1 -22
- package/types/node.d.ts +4 -4
- package/types/opencv.d.ts +135 -135
- package/types/plist.d.ts +4 -4
- package/types/sqlite.d.ts +119 -0
- package/types/system.d.ts +2 -2
- package/types/thread.d.ts +2 -2
- package/types/tomatoocr.d.ts +1 -1
- package/types/yolo.d.ts +2 -2
- package/types/yoloCls.d.ts +2 -2
- package/types/zh/AI/346/250/241/345/235/227.d.ts +17 -17
- package/types/zh/HID/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh/HTTP/346/250/241/345/235/227.d.ts +4 -4
- package/types/zh/MySql/346/250/241/345/235/227.d.ts +4 -4
- package/types/zh/SQLite/346/250/241/345/235/227.d.ts +129 -0
- package/types/zh/YOLO/345/210/206/347/261/273/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh/YOLO/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh/ZIP/346/250/241/345/235/227.d.ts +43 -0
- package/types/zh/index.d.ts +2 -0
- package/types/zh//345/215/241/345/257/206/346/250/241/345/235/227.d.ts +1 -22
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +13 -13
- package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +12 -12
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +3 -3
- package/types/zh//347/272/277/347/250/213/346/250/241/345/235/227.d.ts +2 -2
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +4 -4
- package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +1 -1
- package/types/zipFile.d.ts +41 -0
package/package.json
CHANGED
package/types/ai.d.ts
CHANGED
|
@@ -92,11 +92,11 @@ declare namespace ai {
|
|
|
92
92
|
* 登记或更新模型供应商(脚本开头调用一次;只存内存,脚本停止即清空)
|
|
93
93
|
* 可登记多个:便宜的文本模型做默认,视觉模型单独一个,调用时用 options.provider 选
|
|
94
94
|
* @param config 新建至少要有 baseUrl、model(protocol 缺省 openai);同 id 再次调用为更新,没传的字段沿用旧值
|
|
95
|
-
* @returns 保存后的完整配置;protocol 不合法或缺 baseUrl / model 时返回
|
|
95
|
+
* @returns 保存后的完整配置;protocol 不合法或缺 baseUrl / model 时返回 undefined
|
|
96
96
|
* @example
|
|
97
97
|
* ai.setProvider({ name: "DeepSeek", protocol: "openai", baseUrl: "https://api.deepseek.com", apiKey: "sk-...", model: "deepseek-v4-flash" })
|
|
98
98
|
*/
|
|
99
|
-
function setProvider(config: Partial<AiProvider>): AiProvider |
|
|
99
|
+
function setProvider(config: Partial<AiProvider>): AiProvider | undefined;
|
|
100
100
|
/**
|
|
101
101
|
* 列出已登记的供应商,默认项排在最前
|
|
102
102
|
* @example ai.getProviders().forEach(p => logi(p.name))
|
|
@@ -104,10 +104,10 @@ declare namespace ai {
|
|
|
104
104
|
function getProviders(): AiProvider[];
|
|
105
105
|
/**
|
|
106
106
|
* 获取默认供应商
|
|
107
|
-
* @returns 一个都没登记时返回
|
|
107
|
+
* @returns 一个都没登记时返回 undefined
|
|
108
108
|
* @example const p = ai.getDefaultProvider()
|
|
109
109
|
*/
|
|
110
|
-
function getDefaultProvider(): AiProvider |
|
|
110
|
+
function getDefaultProvider(): AiProvider | undefined;
|
|
111
111
|
/**
|
|
112
112
|
* 切换默认供应商
|
|
113
113
|
* @param id 供应商 id 或 name
|
|
@@ -126,12 +126,12 @@ declare namespace ai {
|
|
|
126
126
|
* 单轮提问,可附带图片
|
|
127
127
|
* @param prompt 问题
|
|
128
128
|
* @param options 可选参数,图片参数与 image 模块一致:image 为 imageId,x/y/ex/ey 同 image.clip 裁剪
|
|
129
|
-
* @returns 回复文本;失败返回
|
|
129
|
+
* @returns 回复文本;失败返回 undefined
|
|
130
130
|
* @example
|
|
131
131
|
* ai.ask("屏幕上有几个按钮?", { image: "screen" })
|
|
132
132
|
* ai.ask("这个区域的价格是多少?", { image: "screen", x: 0, y: 300, ex: 750, ey: 500 })
|
|
133
133
|
*/
|
|
134
|
-
function ask(prompt: string, options?: AiOptions): string |
|
|
134
|
+
function ask(prompt: string, options?: AiOptions): string | undefined;
|
|
135
135
|
/**
|
|
136
136
|
* 是非判断:让模型只回答 yes / no
|
|
137
137
|
* @param question 要判断的问题
|
|
@@ -144,35 +144,35 @@ declare namespace ai {
|
|
|
144
144
|
* 结构化提取:要求模型输出 JSON 并解析成对象或数组
|
|
145
145
|
* @param prompt 提取要求
|
|
146
146
|
* @param options 同 ask,另支持 schema
|
|
147
|
-
* @returns 解析后的对象或数组;没有合法 JSON 或请求失败返回
|
|
147
|
+
* @returns 解析后的对象或数组;没有合法 JSON 或请求失败返回 undefined
|
|
148
148
|
* @example
|
|
149
149
|
* const d = ai.extract("提取验证码", { image: "screen", x: 100, y: 800, ex: 600, ey: 900, schema: { code: "string" } })
|
|
150
150
|
* if (d) logi(d.code)
|
|
151
151
|
*/
|
|
152
|
-
function extract(prompt: string, options?: AiOptions): any |
|
|
152
|
+
function extract(prompt: string, options?: AiOptions): any | undefined;
|
|
153
153
|
/**
|
|
154
|
-
* 多轮对话:自己维护完整消息数组,每次整表传入。失败返回
|
|
154
|
+
* 多轮对话:自己维护完整消息数组,每次整表传入。失败返回 undefined,不要把空回复推进历史。
|
|
155
155
|
* @param messages 消息数组;直接写字符串等于 user 消息;图片写在该条消息上
|
|
156
156
|
* @param options provider / model / temperature / maxTokens / json / timeout(不用 system / image)
|
|
157
|
-
* @returns 回复文本;失败返回
|
|
157
|
+
* @returns 回复文本;失败返回 undefined
|
|
158
158
|
* @example
|
|
159
159
|
* ai.chat([{ role: "system", content: "你是助手" }, { role: "user", content: "看下这是哪个页面", image: "screen" }])
|
|
160
160
|
*/
|
|
161
161
|
function chat(
|
|
162
162
|
messages: (AiMessage | string)[],
|
|
163
163
|
options?: AiOptions,
|
|
164
|
-
): string |
|
|
164
|
+
): string | undefined;
|
|
165
165
|
/**
|
|
166
166
|
* 从模型文本里解析 JSON,自动剥掉 Markdown 代码块和前后解释
|
|
167
167
|
* @param text 模型输出
|
|
168
|
-
* @returns 解析结果;失败返回
|
|
168
|
+
* @returns 解析结果;失败返回 undefined
|
|
169
169
|
* @example ai.parseJson("```json\n{\"a\":1}\n```")
|
|
170
170
|
*/
|
|
171
|
-
function parseJson(text: string): any |
|
|
171
|
+
function parseJson(text: string): any | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* 最近一次调用失败的原因
|
|
174
|
-
* @returns 错误文案;上一次调用成功时返回
|
|
175
|
-
* @example if (ai.ask("你好") ===
|
|
174
|
+
* @returns 错误文案;上一次调用成功时返回 undefined
|
|
175
|
+
* @example if (ai.ask("你好") === undefined) loge(ai.lastError())
|
|
176
176
|
*/
|
|
177
|
-
function lastError(): string |
|
|
177
|
+
function lastError(): string | undefined;
|
|
178
178
|
}
|
package/types/config.d.ts
CHANGED
package/types/dotocr.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ declare namespace dotOcr {
|
|
|
19
19
|
* 从资源路径加载字库并缓存。
|
|
20
20
|
* 常见路径如 `/fonts/default.json`;运行时会解析 `res` 目录。
|
|
21
21
|
* 字库 JSON 中每个字符自带前景色/偏色(`threshold`),识别时按各字颜色匹配。
|
|
22
|
-
* @returns 成功返回字库 ID,失败返回 `
|
|
22
|
+
* @returns 成功返回字库 ID,失败返回 `undefined`
|
|
23
23
|
* @example dotOcr.loadFont("/fonts/default.json")
|
|
24
24
|
*/
|
|
25
|
-
function loadFont(fontPath: string): string |
|
|
25
|
+
function loadFont(fontPath: string): string | undefined;
|
|
26
26
|
|
|
27
27
|
/** 释放指定字库。未加载也视为成功。
|
|
28
28
|
* @example dotOcr.free("fontId")
|
package/types/file.d.ts
CHANGED
|
@@ -35,10 +35,10 @@ declare namespace file {
|
|
|
35
35
|
/**
|
|
36
36
|
* 读取文件内容
|
|
37
37
|
* @param path 文件路径
|
|
38
|
-
* @returns 文件内容,如果读取失败返回
|
|
38
|
+
* @returns 文件内容,如果读取失败返回 undefined
|
|
39
39
|
* @example file.readFile("config.json")
|
|
40
40
|
*/
|
|
41
|
-
function readFile(path: string): string |
|
|
41
|
+
function readFile(path: string): string | undefined;
|
|
42
42
|
/**
|
|
43
43
|
* 读取资源文件
|
|
44
44
|
* @param fileName 文件名
|
|
@@ -46,18 +46,18 @@ declare namespace file {
|
|
|
46
46
|
* @example
|
|
47
47
|
* file.readResFile("test.txt")
|
|
48
48
|
*/
|
|
49
|
-
function readResFile(fileName: string): string |
|
|
49
|
+
function readResFile(fileName: string): string | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* 获取 res 资源的本地文件路径
|
|
52
52
|
* @param fileName 相对 res 目录的资源路径
|
|
53
|
-
* @returns 本地文件绝对路径,失败返回
|
|
53
|
+
* @returns 本地文件绝对路径,失败返回 undefined
|
|
54
54
|
* @example
|
|
55
55
|
* const path = file.getResFile("model.bin");
|
|
56
56
|
* if (path) {
|
|
57
57
|
* file.cleanupResFile(path);
|
|
58
58
|
* }
|
|
59
59
|
*/
|
|
60
|
-
function getResFile(fileName: string): string |
|
|
60
|
+
function getResFile(fileName: string): string | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* 清理由 getResFile 得到的本地文件
|
|
63
63
|
* @param path getResFile 返回的文件路径
|
|
@@ -68,9 +68,9 @@ declare namespace file {
|
|
|
68
68
|
* 删除文件内容
|
|
69
69
|
* @param path 文件路径
|
|
70
70
|
* @param line 行号 如果是-1 代表这个条件不生效
|
|
71
|
-
* @param contains
|
|
71
|
+
* @param contains 包含内容;省略则不按内容删除
|
|
72
72
|
* @returns 是否删除成功
|
|
73
|
-
* @example file.deleteLine("config.json", 1
|
|
73
|
+
* @example file.deleteLine("config.json", 1)
|
|
74
74
|
*/
|
|
75
75
|
function deleteLine(path: string, line: number, contains?: string): boolean;
|
|
76
76
|
/**
|
|
@@ -101,17 +101,17 @@ declare namespace file {
|
|
|
101
101
|
* 读取文件第N行内容
|
|
102
102
|
* @param path 文件路径
|
|
103
103
|
* @param lineNo 行号
|
|
104
|
-
* @returns 行内容,如果读取失败返回
|
|
104
|
+
* @returns 行内容,如果读取失败返回 undefined
|
|
105
105
|
* @example file.readLine("config.json", 1)
|
|
106
106
|
*/
|
|
107
|
-
function readLine(path: string, lineNo: number): string |
|
|
107
|
+
function readLine(path: string, lineNo: number): string | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* 读取文件所有行内容
|
|
110
110
|
* @param path 文件路径
|
|
111
|
-
* @returns 行内容数组,如果读取失败返回
|
|
111
|
+
* @returns 行内容数组,如果读取失败返回 undefined
|
|
112
112
|
* @example file.readAllLines("config.json")
|
|
113
113
|
*/
|
|
114
|
-
function readAllLines(path: string): string[] |
|
|
114
|
+
function readAllLines(path: string): string[] | undefined;
|
|
115
115
|
/**
|
|
116
116
|
* 文件或者文件夹是否存在
|
|
117
117
|
* @param path 文件路径
|
|
@@ -133,5 +133,5 @@ declare namespace file {
|
|
|
133
133
|
* @returns 文件MD5值
|
|
134
134
|
* @example file.fileMD5("config.json")
|
|
135
135
|
*/
|
|
136
|
-
function fileMD5(path: string): string |
|
|
136
|
+
function fileMD5(path: string): string | undefined;
|
|
137
137
|
}
|
package/types/hid.d.ts
CHANGED
package/types/hotUpdate.d.ts
CHANGED
package/types/http.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ declare namespace http {
|
|
|
115
115
|
* 响应体
|
|
116
116
|
*/
|
|
117
117
|
body: string;
|
|
118
|
-
} |
|
|
118
|
+
} | undefined;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* 下载文件 支持断点续传
|
|
@@ -149,7 +149,7 @@ declare namespace http {
|
|
|
149
149
|
params?: Record<string, string>,
|
|
150
150
|
timeout?: number,
|
|
151
151
|
headers?: Record<string, string>,
|
|
152
|
-
): string |
|
|
152
|
+
): string | undefined;
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* 发送POST请求
|
|
@@ -168,7 +168,7 @@ declare namespace http {
|
|
|
168
168
|
files?: Record<string, string>,
|
|
169
169
|
timeout?: number,
|
|
170
170
|
headers?: Record<string, string>,
|
|
171
|
-
): string |
|
|
171
|
+
): string | undefined;
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* 发送JSON请求
|
|
@@ -188,7 +188,7 @@ declare namespace http {
|
|
|
188
188
|
json?: Record<string, any>,
|
|
189
189
|
timeout?: number,
|
|
190
190
|
headers?: Record<string, string>,
|
|
191
|
-
): string |
|
|
191
|
+
): string | undefined;
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* 创建WebSocket连接
|
package/types/image.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare namespace image {
|
|
|
8
8
|
* @param y 截图区域左上角y坐标
|
|
9
9
|
* @param ex 截图区域右下角x坐标
|
|
10
10
|
* @param ey 截图区域右下角y坐标
|
|
11
|
-
* @returns 截图的imageId ,如果截图失败则返回
|
|
11
|
+
* @returns 截图的imageId ,如果截图失败则返回 undefined
|
|
12
12
|
* @example
|
|
13
13
|
* const imageId = image.captureScreen()
|
|
14
14
|
* if (imageId) {
|
|
@@ -20,7 +20,7 @@ declare namespace image {
|
|
|
20
20
|
y?: number,
|
|
21
21
|
ex?: number,
|
|
22
22
|
ey?: number,
|
|
23
|
-
): string |
|
|
23
|
+
): string | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* 保存图片
|
|
26
26
|
* @param imageId 图片id 路径 http地址或者 screen 实时截屏
|
|
@@ -66,11 +66,11 @@ declare namespace image {
|
|
|
66
66
|
* logi(size.width, size.height)
|
|
67
67
|
* }
|
|
68
68
|
*/
|
|
69
|
-
function getSize(imageId: string): { width: number; height: number } |
|
|
69
|
+
function getSize(imageId: string): { width: number; height: number } | undefined;
|
|
70
70
|
/**
|
|
71
71
|
* 读取图片
|
|
72
72
|
* @param path 图片路径
|
|
73
|
-
* @returns 图片id ,如果读取失败则返回
|
|
73
|
+
* @returns 图片id ,如果读取失败则返回 undefined
|
|
74
74
|
* @example
|
|
75
75
|
* const imageId = image.readImage("screen.jpg")
|
|
76
76
|
* if (imageId) {
|
|
@@ -78,12 +78,12 @@ declare namespace image {
|
|
|
78
78
|
* }
|
|
79
79
|
* image.release(imageId)
|
|
80
80
|
*/
|
|
81
|
-
function readImage(path: string): string |
|
|
81
|
+
function readImage(path: string): string | undefined;
|
|
82
82
|
/**
|
|
83
83
|
* 旋转图片
|
|
84
84
|
* @param imageId 图片id
|
|
85
85
|
* @param degree 旋转角度 只能是 90 -90 180
|
|
86
|
-
* @returns 旋转后的图片id ,如果旋转失败则返回
|
|
86
|
+
* @returns 旋转后的图片id ,如果旋转失败则返回 undefined
|
|
87
87
|
* @example
|
|
88
88
|
* const imageId = image.readImage("screen.jpg")
|
|
89
89
|
* if (imageId) {
|
|
@@ -94,7 +94,7 @@ declare namespace image {
|
|
|
94
94
|
* image.release(imageId)
|
|
95
95
|
* }
|
|
96
96
|
*/
|
|
97
|
-
function rotateImage(imageId: string, degree: number): string |
|
|
97
|
+
function rotateImage(imageId: string, degree: number): string | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* 比较颜色
|
|
100
100
|
* @param imageId 图片id
|
|
@@ -313,7 +313,7 @@ declare namespace image {
|
|
|
313
313
|
y: number,
|
|
314
314
|
ex: number,
|
|
315
315
|
ey: number,
|
|
316
|
-
): string |
|
|
316
|
+
): string | undefined;
|
|
317
317
|
/**
|
|
318
318
|
* 获取图片像素
|
|
319
319
|
* @param imageId 图片id
|
|
@@ -357,7 +357,7 @@ declare namespace image {
|
|
|
357
357
|
* }
|
|
358
358
|
* image.release(imageId)
|
|
359
359
|
*/
|
|
360
|
-
function binaryzation(imageId: string, threshold: number): string |
|
|
360
|
+
function binaryzation(imageId: string, threshold: number): string | undefined;
|
|
361
361
|
/**
|
|
362
362
|
* 灰度化
|
|
363
363
|
* @param imageId 图片id
|
|
@@ -372,7 +372,7 @@ declare namespace image {
|
|
|
372
372
|
* }
|
|
373
373
|
* image.release(imageId)
|
|
374
374
|
*/
|
|
375
|
-
function gray(imageId: string): string |
|
|
375
|
+
function gray(imageId: string): string | undefined;
|
|
376
376
|
/**
|
|
377
377
|
* base64转图片
|
|
378
378
|
* @param base64 base64字符串
|
|
@@ -384,7 +384,7 @@ declare namespace image {
|
|
|
384
384
|
* }
|
|
385
385
|
* image.release(imageId)
|
|
386
386
|
*/
|
|
387
|
-
function base64ToImage(base64: string): string |
|
|
387
|
+
function base64ToImage(base64: string): string | undefined;
|
|
388
388
|
/**
|
|
389
389
|
* 图片转base64
|
|
390
390
|
* @param imageId 图片id
|
|
@@ -403,7 +403,7 @@ declare namespace image {
|
|
|
403
403
|
imageId: string,
|
|
404
404
|
format: string,
|
|
405
405
|
q: number,
|
|
406
|
-
): string |
|
|
406
|
+
): string | undefined;
|
|
407
407
|
/**
|
|
408
408
|
* 扫描条码 支持一维码和二维码
|
|
409
409
|
* @param imageId 图片id
|
|
@@ -417,7 +417,7 @@ declare namespace image {
|
|
|
417
417
|
* }
|
|
418
418
|
* }
|
|
419
419
|
*/
|
|
420
|
-
function scanCode(imageId: string): string |
|
|
420
|
+
function scanCode(imageId: string): string | undefined;
|
|
421
421
|
/**
|
|
422
422
|
* 绘制矩形
|
|
423
423
|
* @param imageId 图片id
|
package/types/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
/// <reference path="jbclear.d.ts" />
|
|
19
19
|
/// <reference path="jbsystem.d.ts" />
|
|
20
20
|
/// <reference path="jbdevice.d.ts" />
|
|
21
|
+
/// <reference path="jbpower.d.ts" />
|
|
21
22
|
/// <reference path="jbvpn.d.ts" />
|
|
23
|
+
/// <reference path="jbdraw.d.ts" />
|
|
22
24
|
/// <reference path="logger.d.ts" />
|
|
23
25
|
/// <reference path="media.d.ts" />
|
|
24
26
|
/// <reference path="mysql.d.ts" />
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
/// <reference path="paddleocr.d.ts" />
|
|
29
31
|
/// <reference path="pip.d.ts" />
|
|
30
32
|
/// <reference path="plist.d.ts" />
|
|
33
|
+
/// <reference path="sqlite.d.ts" />
|
|
31
34
|
/// <reference path="system.d.ts" />
|
|
32
35
|
/// <reference path="thread.d.ts" />
|
|
33
36
|
/// <reference path="tomatoocr.d.ts" />
|
|
@@ -37,4 +40,5 @@
|
|
|
37
40
|
/// <reference path="utils.d.ts" />
|
|
38
41
|
/// <reference path="yolo.d.ts" />
|
|
39
42
|
/// <reference path="yoloCls.d.ts" />
|
|
43
|
+
/// <reference path="zipFile.d.ts" />
|
|
40
44
|
/// <reference path="zh/index.d.ts" />
|
package/types/jbclear.d.ts
CHANGED
|
@@ -43,43 +43,43 @@ declare namespace jbclear {
|
|
|
43
43
|
function appData(bundleId: string): boolean;
|
|
44
44
|
/**
|
|
45
45
|
* 读取整机广告标识(IDFA)。
|
|
46
|
-
* @returns UUID 字符串;读不到返回 `
|
|
46
|
+
* @returns UUID 字符串;读不到返回 `undefined`
|
|
47
47
|
* @example const idfa = jbclear.getIdfa()
|
|
48
48
|
*/
|
|
49
|
-
function getIdfa(): string |
|
|
49
|
+
function getIdfa(): string | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* 重置整机广告标识(IDFA)。之后所有 App 读到的都会变。
|
|
52
|
-
* @returns 重置前的 UUID;失败返回 `
|
|
52
|
+
* @returns 重置前的 UUID;失败返回 `undefined`
|
|
53
53
|
* @example const old = jbclear.resetIdfa()
|
|
54
54
|
*/
|
|
55
|
-
function resetIdfa(): string |
|
|
55
|
+
function resetIdfa(): string | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* 写入整机广告标识(IDFA)。
|
|
58
58
|
* @param value UUID 字符串
|
|
59
|
-
* @returns 写入前的 UUID;失败返回 `
|
|
59
|
+
* @returns 写入前的 UUID;失败返回 `undefined`
|
|
60
60
|
* @example jbclear.setIdfa(old)
|
|
61
61
|
*/
|
|
62
|
-
function setIdfa(value: string): string |
|
|
62
|
+
function setIdfa(value: string): string | undefined;
|
|
63
63
|
/**
|
|
64
64
|
* 读取指定应用所属开发商的供应商标识(IDFV)。
|
|
65
65
|
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
66
|
-
* @returns UUID 字符串;读不到返回 `
|
|
66
|
+
* @returns UUID 字符串;读不到返回 `undefined`
|
|
67
67
|
* @example const idfv = jbclear.getIdfv("demo.sample.app")
|
|
68
68
|
*/
|
|
69
|
-
function getIdfv(bundleId: string): string |
|
|
69
|
+
function getIdfv(bundleId: string): string | undefined;
|
|
70
70
|
/**
|
|
71
71
|
* 重置指定应用所属开发商的 IDFV。同一开发商的 App 会一起变。
|
|
72
72
|
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
73
|
-
* @returns 重置前的 UUID;失败返回 `
|
|
73
|
+
* @returns 重置前的 UUID;失败返回 `undefined`
|
|
74
74
|
* @example const old = jbclear.resetIdfv("demo.sample.app")
|
|
75
75
|
*/
|
|
76
|
-
function resetIdfv(bundleId: string): string |
|
|
76
|
+
function resetIdfv(bundleId: string): string | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* 写入指定应用所属开发商的 IDFV。
|
|
79
79
|
* @param bundleId 应用包标识符,例如 `"demo.sample.app"`
|
|
80
80
|
* @param value UUID 字符串
|
|
81
|
-
* @returns 写入前的 UUID;失败返回 `
|
|
81
|
+
* @returns 写入前的 UUID;失败返回 `undefined`
|
|
82
82
|
* @example jbclear.setIdfv("demo.sample.app", old)
|
|
83
83
|
*/
|
|
84
|
-
function setIdfv(bundleId: string, value: string): string |
|
|
84
|
+
function setIdfv(bundleId: string, value: string): string | undefined;
|
|
85
85
|
}
|
package/types/jbdevice.d.ts
CHANGED
|
@@ -38,28 +38,28 @@ declare namespace jbdevice {
|
|
|
38
38
|
function restoreAutoLock(): boolean;
|
|
39
39
|
/**
|
|
40
40
|
* 读取当前自动锁屏分钟数。`0` 表示不自动锁屏。
|
|
41
|
-
* @returns 分钟数;读不到返回 `
|
|
41
|
+
* @returns 分钟数;读不到返回 `undefined`
|
|
42
42
|
* @example jbdevice.getAutoLockMinutes()
|
|
43
43
|
*/
|
|
44
|
-
function getAutoLockMinutes(): number |
|
|
44
|
+
function getAutoLockMinutes(): number | undefined;
|
|
45
45
|
/**
|
|
46
46
|
* 读取设备序列号。
|
|
47
|
-
* @returns 序列号;读不到返回 `
|
|
47
|
+
* @returns 序列号;读不到返回 `undefined`
|
|
48
48
|
* @example jbdevice.serialNumber()
|
|
49
49
|
*/
|
|
50
|
-
function serialNumber(): string |
|
|
50
|
+
function serialNumber(): string | undefined;
|
|
51
51
|
/**
|
|
52
52
|
* 读取本机 Wi-Fi MAC。
|
|
53
|
-
* @returns `aa:bb:cc:dd:ee:ff` 形式;读不到返回 `
|
|
53
|
+
* @returns `aa:bb:cc:dd:ee:ff` 形式;读不到返回 `undefined`
|
|
54
54
|
* @example jbdevice.wifiMac()
|
|
55
55
|
*/
|
|
56
|
-
function wifiMac(): string |
|
|
56
|
+
function wifiMac(): string | undefined;
|
|
57
57
|
/**
|
|
58
|
-
* 读取当前已连接无线网信息。没连上返回 `
|
|
59
|
-
* @returns Wi-Fi 信息;没连上返回 `
|
|
58
|
+
* 读取当前已连接无线网信息。没连上返回 `undefined`。
|
|
59
|
+
* @returns Wi-Fi 信息;没连上返回 `undefined`
|
|
60
60
|
* @example jbdevice.wifiInfo()
|
|
61
61
|
*/
|
|
62
|
-
function wifiInfo(): WifiInfo |
|
|
62
|
+
function wifiInfo(): WifiInfo | undefined;
|
|
63
63
|
/**
|
|
64
64
|
* 打开 Wi-Fi。
|
|
65
65
|
* @returns 成功为 `true`
|
|
@@ -74,10 +74,10 @@ declare namespace jbdevice {
|
|
|
74
74
|
function wifiOff(): boolean;
|
|
75
75
|
/**
|
|
76
76
|
* 读取 Wi-Fi 是否打开。
|
|
77
|
-
* @returns 当前是否打开;读不到返回 `
|
|
77
|
+
* @returns 当前是否打开;读不到返回 `undefined`
|
|
78
78
|
* @example jbdevice.isWifiOn()
|
|
79
79
|
*/
|
|
80
|
-
function isWifiOn(): boolean |
|
|
80
|
+
function isWifiOn(): boolean | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* 打开蓝牙。
|
|
83
83
|
* @returns 成功为 `true`
|
|
@@ -92,10 +92,10 @@ declare namespace jbdevice {
|
|
|
92
92
|
function bluetoothOff(): boolean;
|
|
93
93
|
/**
|
|
94
94
|
* 读取蓝牙是否打开。
|
|
95
|
-
* @returns 当前是否打开;读不到返回 `
|
|
95
|
+
* @returns 当前是否打开;读不到返回 `undefined`
|
|
96
96
|
* @example jbdevice.isBluetoothOn()
|
|
97
97
|
*/
|
|
98
|
-
function isBluetoothOn(): boolean |
|
|
98
|
+
function isBluetoothOn(): boolean | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* 打开蜂窝数据。
|
|
101
101
|
* @returns 成功为 `true`
|
|
@@ -110,10 +110,10 @@ declare namespace jbdevice {
|
|
|
110
110
|
function cellularOff(): boolean;
|
|
111
111
|
/**
|
|
112
112
|
* 读取蜂窝数据是否打开。没有蜂窝能力时失败。
|
|
113
|
-
* @returns 当前是否打开;读不到返回 `
|
|
113
|
+
* @returns 当前是否打开;读不到返回 `undefined`
|
|
114
114
|
* @example jbdevice.isCellularOn()
|
|
115
115
|
*/
|
|
116
|
-
function isCellularOn(): boolean |
|
|
116
|
+
function isCellularOn(): boolean | undefined;
|
|
117
117
|
/**
|
|
118
118
|
* 打开飞行模式。
|
|
119
119
|
* @returns 成功为 `true`
|
|
@@ -128,10 +128,10 @@ declare namespace jbdevice {
|
|
|
128
128
|
function airplaneOff(): boolean;
|
|
129
129
|
/**
|
|
130
130
|
* 读取飞行模式是否打开。
|
|
131
|
-
* @returns 当前是否打开;读不到返回 `
|
|
131
|
+
* @returns 当前是否打开;读不到返回 `undefined`
|
|
132
132
|
* @example jbdevice.isAirplaneOn()
|
|
133
133
|
*/
|
|
134
|
-
function isAirplaneOn(): boolean |
|
|
134
|
+
function isAirplaneOn(): boolean | undefined;
|
|
135
135
|
/**
|
|
136
136
|
* 加入一个无线网。开放网络密码传空串。有密码时至少 8 位。
|
|
137
137
|
* @param ssid 无线网名称,也可传 BSSID
|
|
@@ -150,17 +150,17 @@ declare namespace jbdevice {
|
|
|
150
150
|
function forgetWifi(ssid: string): boolean;
|
|
151
151
|
/**
|
|
152
152
|
* 列出已保存的无线网。没有已存网络时是空数组。
|
|
153
|
-
* @returns Wi-Fi 信息数组;读失败返回 `
|
|
153
|
+
* @returns Wi-Fi 信息数组;读失败返回 `undefined`
|
|
154
154
|
* @example jbdevice.listWifi()
|
|
155
155
|
*/
|
|
156
|
-
function listWifi(): WifiInfo[] |
|
|
156
|
+
function listWifi(): WifiInfo[] | undefined;
|
|
157
157
|
/**
|
|
158
158
|
* 扫描附近无线网。会先打开 Wi-Fi。
|
|
159
159
|
* @param timeoutMs 等待上限毫秒;省略或 `<= 0` 时用 `15000`,最短 `5000`,最长 `120000`
|
|
160
|
-
* @returns Wi-Fi 信息数组;扫失败返回 `
|
|
160
|
+
* @returns Wi-Fi 信息数组;扫失败返回 `undefined`。附近没有网时是空数组
|
|
161
161
|
* @example jbdevice.scanWifi()
|
|
162
162
|
*/
|
|
163
|
-
function scanWifi(timeoutMs?: number): WifiInfo[] |
|
|
163
|
+
function scanWifi(timeoutMs?: number): WifiInfo[] | undefined;
|
|
164
164
|
/**
|
|
165
165
|
* 设置系统音量,范围 `0.0-1.0`。
|
|
166
166
|
* @param volume 目标音量
|
|
@@ -170,10 +170,10 @@ declare namespace jbdevice {
|
|
|
170
170
|
function setVolume(volume: number): boolean;
|
|
171
171
|
/**
|
|
172
172
|
* 读取系统音量,范围 `0.0-1.0`。
|
|
173
|
-
* @returns 当前音量;读不到返回 `
|
|
173
|
+
* @returns 当前音量;读不到返回 `undefined`
|
|
174
174
|
* @example jbdevice.getVolume()
|
|
175
175
|
*/
|
|
176
|
-
function getVolume(): number |
|
|
176
|
+
function getVolume(): number | undefined;
|
|
177
177
|
/**
|
|
178
178
|
* 设置背光亮度,范围 `0.0-1.0`。
|
|
179
179
|
* @param brightness 目标亮度
|
|
@@ -183,8 +183,8 @@ declare namespace jbdevice {
|
|
|
183
183
|
function setBrightness(brightness: number): boolean;
|
|
184
184
|
/**
|
|
185
185
|
* 读取背光亮度,范围 `0.0-1.0`。
|
|
186
|
-
* @returns 当前亮度;读不到返回 `
|
|
186
|
+
* @returns 当前亮度;读不到返回 `undefined`
|
|
187
187
|
* @example jbdevice.getBrightness()
|
|
188
188
|
*/
|
|
189
|
-
function getBrightness(): number |
|
|
189
|
+
function getBrightness(): number | undefined;
|
|
190
190
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 越狱绘制模块。仅越狱包提供,免越狱包没有该对象。
|
|
3
|
+
*
|
|
4
|
+
* 在屏幕上画矩形和文字。每画一次返回一个 id,可用 `clear` 去掉这一条,或 `clearAll` 全部去掉。
|
|
5
|
+
* 坐标为像素坐标。颜色只接受 `#RRGGBB` 和 `#RRGGBBAA`。需要字加底时先画填充矩形,再画文字。
|
|
6
|
+
*/
|
|
7
|
+
declare namespace jbdraw {
|
|
8
|
+
/**
|
|
9
|
+
* 画矩形时的可选参数。
|
|
10
|
+
*/
|
|
11
|
+
interface JbDrawRectOptions {
|
|
12
|
+
/**
|
|
13
|
+
* 边框颜色。`#RRGGBB` 或 `#RRGGBBAA`。省略为 `#FF0000`。
|
|
14
|
+
*/
|
|
15
|
+
color?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 边框宽度。省略为 `2`。`<= 0` 不画边框。
|
|
18
|
+
*/
|
|
19
|
+
lineWidth?: number;
|
|
20
|
+
/**
|
|
21
|
+
* 填充颜色。`#RRGGBB` 或 `#RRGGBBAA`。省略不填充。
|
|
22
|
+
*/
|
|
23
|
+
fill?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 画文字时的可选参数。
|
|
27
|
+
*/
|
|
28
|
+
interface JbDrawTextOptions {
|
|
29
|
+
/**
|
|
30
|
+
* 文字颜色。`#RRGGBB` 或 `#RRGGBBAA`。省略为 `#FFFFFF`。
|
|
31
|
+
*/
|
|
32
|
+
color?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 系统字号。省略为 `16`。`<= 0` 时画字失败。
|
|
35
|
+
*/
|
|
36
|
+
fontSize?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 在屏幕上画矩形。
|
|
40
|
+
* 需要字加底时先画填充矩形,再 `text`。
|
|
41
|
+
* @param x 左上角 x,像素坐标
|
|
42
|
+
* @param y 左上角 y,像素坐标
|
|
43
|
+
* @param width 宽度,必须大于 0
|
|
44
|
+
* @param height 高度,必须大于 0
|
|
45
|
+
* @param options 颜色、边框、填充
|
|
46
|
+
* @returns 成功返回 id(从 1 起);失败返回 `0`
|
|
47
|
+
* @example const box = jbdraw.rect(20, 80, 200, 40, { fill: "#000000AA", lineWidth: 0 })
|
|
48
|
+
*/
|
|
49
|
+
function rect(
|
|
50
|
+
x: number,
|
|
51
|
+
y: number,
|
|
52
|
+
width: number,
|
|
53
|
+
height: number,
|
|
54
|
+
options?: JbDrawRectOptions
|
|
55
|
+
): number;
|
|
56
|
+
/**
|
|
57
|
+
* 在屏幕上画文字,左上角对齐,没有背景。
|
|
58
|
+
* @param x 文字左上角 x,像素坐标
|
|
59
|
+
* @param y 文字左上角 y,像素坐标
|
|
60
|
+
* @param text 要画的字符串
|
|
61
|
+
* @param options 颜色和字号
|
|
62
|
+
* @returns 成功返回 id(从 1 起);失败返回 `0`
|
|
63
|
+
* @example const label = jbdraw.text(28, 88, "hello", { fontSize: 18 })
|
|
64
|
+
*/
|
|
65
|
+
function text(
|
|
66
|
+
x: number,
|
|
67
|
+
y: number,
|
|
68
|
+
text: string,
|
|
69
|
+
options?: JbDrawTextOptions
|
|
70
|
+
): number;
|
|
71
|
+
/**
|
|
72
|
+
* 去掉一个图形。
|
|
73
|
+
* @param id `rect` / `text` 返回的 id
|
|
74
|
+
* @returns 找到并移除为 `true`
|
|
75
|
+
* @example jbdraw.clear(id)
|
|
76
|
+
*/
|
|
77
|
+
function clear(id: number): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 去掉当前全部图形。
|
|
80
|
+
* @example jbdraw.clearAll()
|
|
81
|
+
*/
|
|
82
|
+
function clearAll(): void;
|
|
83
|
+
}
|