ms-types 0.0.67 → 0.0.69
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/http.d.ts +19 -19
- package/types/image.d.ts +2 -3
- package/types/zh/HTTP/346/250/241/345/235/227.d.ts +19 -19
- package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +15 -10
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +2 -3
- package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +6 -6
package/package.json
CHANGED
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(
|
|
280
|
+
* logi(image.argb(color))
|
|
282
281
|
* }
|
|
283
282
|
* image.release(imageId)
|
|
284
283
|
*/
|
|
285
|
-
function argb(
|
|
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
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare type 回调 = Function;
|
|
2
1
|
declare type 布尔值 = boolean;
|
|
3
2
|
declare type 字符串 = string;
|
|
4
3
|
declare type 数字 = number;
|
|
@@ -8,37 +7,43 @@ declare type 数组<T> = Array<T>;
|
|
|
8
7
|
declare type 字典<T> = Record<字符串, T>;
|
|
9
8
|
declare type 无返回值 = void;
|
|
10
9
|
|
|
10
|
+
/**
|
|
11
|
+
* true 别名
|
|
12
|
+
*/
|
|
11
13
|
declare const $真: 布尔值;
|
|
14
|
+
/**
|
|
15
|
+
* false 别名
|
|
16
|
+
*/
|
|
12
17
|
declare const $假: 布尔值;
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
* 是否是调试模式
|
|
16
21
|
*/
|
|
17
|
-
declare const $是否调试:
|
|
22
|
+
declare const $是否调试: 布尔值;
|
|
18
23
|
/**
|
|
19
24
|
* 是否应该退出应用
|
|
20
25
|
*/
|
|
21
|
-
declare const $是否退出:
|
|
26
|
+
declare const $是否退出: 布尔值;
|
|
22
27
|
/**
|
|
23
28
|
* 应用版本
|
|
24
29
|
*/
|
|
25
|
-
declare const $APP应用版本:
|
|
30
|
+
declare const $APP应用版本: 字符串;
|
|
26
31
|
/**
|
|
27
32
|
* 应用构建号
|
|
28
33
|
*/
|
|
29
|
-
declare const $APP应用构建号:
|
|
34
|
+
declare const $APP应用构建号: 字符串;
|
|
30
35
|
/**
|
|
31
36
|
* 应用名称
|
|
32
37
|
*/
|
|
33
|
-
declare const $APP应用名称:
|
|
38
|
+
declare const $APP应用名称: 字符串;
|
|
34
39
|
/**
|
|
35
40
|
* 应用 bundleId
|
|
36
41
|
*/
|
|
37
|
-
declare const $APP应用包名:
|
|
42
|
+
declare const $APP应用包名: 字符串;
|
|
38
43
|
/**
|
|
39
44
|
* 当前线程名称
|
|
40
45
|
*/
|
|
41
|
-
declare const $线程名称:
|
|
46
|
+
declare const $线程名称: 字符串;
|
|
42
47
|
/**
|
|
43
48
|
* 脚本信息
|
|
44
49
|
*/
|
|
@@ -62,7 +67,7 @@ declare const $脚本配置: {
|
|
|
62
67
|
* $打印信息日志("脚本执行完成");
|
|
63
68
|
* });
|
|
64
69
|
*/
|
|
65
|
-
declare const $设置停止回调: (回调:
|
|
70
|
+
declare const $设置停止回调: (回调: () => 无返回值) => 无返回值;
|
|
66
71
|
|
|
67
72
|
/**
|
|
68
73
|
* 设置异常停止回调(仅主线程调用)
|
|
@@ -73,7 +78,7 @@ declare const $设置停止回调: (回调: 回调) => 无返回值;
|
|
|
73
78
|
* $打印错误日志("脚本执行异常");
|
|
74
79
|
* });
|
|
75
80
|
*/
|
|
76
|
-
declare const $设置异常停止回调: (回调:
|
|
81
|
+
declare const $设置异常停止回调: (回调: () => 无返回值) => 无返回值;
|
|
77
82
|
|
|
78
83
|
/**
|
|
79
84
|
* 重启脚本(仅主线程调用)
|
|
@@ -273,18 +273,17 @@ 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
279
|
* const 图片ID = $图片.从文件读取图片("screen.jpg")
|
|
281
280
|
* if (图片ID) {
|
|
282
281
|
* const 颜色值 = $图片.取像素颜色(图片ID, 0, 0)
|
|
283
|
-
* $打印信息日志($图片.颜色转16进制字符串(
|
|
282
|
+
* $打印信息日志($图片.颜色转16进制字符串(颜色值))
|
|
284
283
|
* }
|
|
285
284
|
* $图片.释放图片(图片ID)
|
|
286
285
|
*/
|
|
287
|
-
function 颜色转16进制字符串(
|
|
286
|
+
function 颜色转16进制字符串(颜色值: 数字): 字符串;
|
|
288
287
|
/**
|
|
289
288
|
* 二值化
|
|
290
289
|
* @param 图片ID
|
|
@@ -12,11 +12,11 @@ declare namespace $设备 {
|
|
|
12
12
|
/**
|
|
13
13
|
* 电池电量
|
|
14
14
|
*/
|
|
15
|
-
level:
|
|
15
|
+
level: 数字;
|
|
16
16
|
/**
|
|
17
17
|
* 是否充电
|
|
18
18
|
*/
|
|
19
|
-
isCharging:
|
|
19
|
+
isCharging: 布尔值;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* 获取设备ID
|
|
@@ -51,11 +51,11 @@ declare namespace $设备 {
|
|
|
51
51
|
/**
|
|
52
52
|
* 屏幕宽度
|
|
53
53
|
*/
|
|
54
|
-
width:
|
|
54
|
+
width: 数字;
|
|
55
55
|
/**
|
|
56
56
|
* 屏幕高度
|
|
57
57
|
*/
|
|
58
|
-
height:
|
|
58
|
+
height: 数字;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* 获取屏幕实际大小
|
|
@@ -66,11 +66,11 @@ declare namespace $设备 {
|
|
|
66
66
|
/**
|
|
67
67
|
* 屏幕宽度
|
|
68
68
|
*/
|
|
69
|
-
width:
|
|
69
|
+
width: 数字;
|
|
70
70
|
/**
|
|
71
71
|
* 屏幕高度
|
|
72
72
|
*/
|
|
73
|
-
height:
|
|
73
|
+
height: 数字;
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
76
|
* 获取屏幕缩放比例
|