assistsx-js 0.0.2021 → 0.0.2022
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/dist/AssistsX.d.ts +20 -0
- package/dist/AssistsX.js +4 -0
- package/dist/AssistsXAsync.d.ts +1 -0
- package/dist/AssistsXAsync.js +5 -1
- package/dist/CallMethod.d.ts +2 -0
- package/dist/CallMethod.js +2 -0
- package/package.json +1 -1
- package/src/AssistsX.ts +45 -0
- package/src/AssistsXAsync.ts +31 -1
- package/src/CallMethod.ts +3 -0
package/dist/AssistsX.d.ts
CHANGED
|
@@ -42,6 +42,25 @@ export interface WebFloatingWindowOptions {
|
|
|
42
42
|
maxHeight?: number;
|
|
43
43
|
initialCenter?: boolean;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* HTTP请求选项接口定义
|
|
47
|
+
*/
|
|
48
|
+
export interface HttpRequestOptions {
|
|
49
|
+
url: string;
|
|
50
|
+
method?: "GET" | "POST";
|
|
51
|
+
headers?: Record<string, string>;
|
|
52
|
+
body?: string;
|
|
53
|
+
timeout?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* HTTP响应数据接口定义
|
|
57
|
+
*/
|
|
58
|
+
export interface HttpResponse {
|
|
59
|
+
statusCode: number;
|
|
60
|
+
statusMessage: string;
|
|
61
|
+
body: string;
|
|
62
|
+
headers: Record<string, string>;
|
|
63
|
+
}
|
|
45
64
|
export declare const callbacks: Map<string, (data: string) => void>;
|
|
46
65
|
export declare const accessibilityEventListeners: AccessibilityEventListener[];
|
|
47
66
|
export declare class AssistsX {
|
|
@@ -364,6 +383,7 @@ export declare class AssistsX {
|
|
|
364
383
|
static getUniqueDeviceId(): any;
|
|
365
384
|
static getAndroidID(): any;
|
|
366
385
|
static getMacAddress(): Promise<any>;
|
|
386
|
+
static getDeviceInfo(): Promise<any>;
|
|
367
387
|
static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
|
|
368
388
|
static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
|
|
369
389
|
/**
|
package/dist/AssistsX.js
CHANGED
|
@@ -566,6 +566,10 @@ export class AssistsX {
|
|
|
566
566
|
const response = await this.asyncCall(CallMethod.getMacAddress);
|
|
567
567
|
return response.getDataOrDefault({});
|
|
568
568
|
}
|
|
569
|
+
static async getDeviceInfo() {
|
|
570
|
+
const response = await this.asyncCall(CallMethod.getDeviceInfo);
|
|
571
|
+
return response.getDataOrDefault({});
|
|
572
|
+
}
|
|
569
573
|
static async setAccessibilityEventFilters(value) {
|
|
570
574
|
const response = this.call(CallMethod.setAccessibilityEventFilters, {
|
|
571
575
|
args: { value },
|
package/dist/AssistsXAsync.d.ts
CHANGED
package/dist/AssistsXAsync.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CallMethod } from "./CallMethod";
|
|
|
7
7
|
import { CallResponse } from "./CallResponse";
|
|
8
8
|
import { Bounds } from "./Bounds";
|
|
9
9
|
import { generateUUID } from "./Utils";
|
|
10
|
-
import { callbacks } from "./AssistsX";
|
|
10
|
+
import { callbacks, } from "./AssistsX";
|
|
11
11
|
export class AssistsXAsync {
|
|
12
12
|
/**
|
|
13
13
|
* 执行异步调用
|
|
@@ -515,6 +515,10 @@ export class AssistsXAsync {
|
|
|
515
515
|
const response = await this.asyncCall(CallMethod.getMacAddress);
|
|
516
516
|
return response.getDataOrDefault({});
|
|
517
517
|
}
|
|
518
|
+
static async getDeviceInfo() {
|
|
519
|
+
const response = await this.asyncCall(CallMethod.getDeviceInfo);
|
|
520
|
+
return response.getDataOrDefault({});
|
|
521
|
+
}
|
|
518
522
|
/**
|
|
519
523
|
* 获取屏幕尺寸
|
|
520
524
|
* @returns 屏幕尺寸对象
|
package/dist/CallMethod.d.ts
CHANGED
|
@@ -44,5 +44,7 @@ export declare const CallMethod: {
|
|
|
44
44
|
readonly getUniqueDeviceId: "getUniqueDeviceId";
|
|
45
45
|
readonly addAccessibilityEventFilter: "addAccessibilityEventFilter";
|
|
46
46
|
readonly setAccessibilityEventFilters: "setAccessibilityEventFilters";
|
|
47
|
+
readonly httpRequest: "httpRequest";
|
|
48
|
+
readonly getDeviceInfo: "getDeviceInfo";
|
|
47
49
|
};
|
|
48
50
|
export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
|
package/dist/CallMethod.js
CHANGED
|
@@ -45,4 +45,6 @@ export const CallMethod = {
|
|
|
45
45
|
getUniqueDeviceId: "getUniqueDeviceId",
|
|
46
46
|
addAccessibilityEventFilter: "addAccessibilityEventFilter",
|
|
47
47
|
setAccessibilityEventFilters: "setAccessibilityEventFilters",
|
|
48
|
+
httpRequest: "httpRequest",
|
|
49
|
+
getDeviceInfo: "getDeviceInfo",
|
|
48
50
|
};
|
package/package.json
CHANGED
package/src/AssistsX.ts
CHANGED
|
@@ -49,6 +49,27 @@ export interface WebFloatingWindowOptions {
|
|
|
49
49
|
initialCenter?: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* HTTP请求选项接口定义
|
|
54
|
+
*/
|
|
55
|
+
export interface HttpRequestOptions {
|
|
56
|
+
url: string;
|
|
57
|
+
method?: "GET" | "POST";
|
|
58
|
+
headers?: Record<string, string>;
|
|
59
|
+
body?: string;
|
|
60
|
+
timeout?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* HTTP响应数据接口定义
|
|
65
|
+
*/
|
|
66
|
+
export interface HttpResponse {
|
|
67
|
+
statusCode: number;
|
|
68
|
+
statusMessage: string;
|
|
69
|
+
body: string;
|
|
70
|
+
headers: Record<string, string>;
|
|
71
|
+
}
|
|
72
|
+
|
|
52
73
|
// 回调函数存储对象
|
|
53
74
|
export const callbacks: Map<string, (data: string) => void> = new Map();
|
|
54
75
|
|
|
@@ -799,6 +820,10 @@ export class AssistsX {
|
|
|
799
820
|
const response = await this.asyncCall(CallMethod.getMacAddress);
|
|
800
821
|
return response.getDataOrDefault({});
|
|
801
822
|
}
|
|
823
|
+
public static async getDeviceInfo(): Promise<any> {
|
|
824
|
+
const response = await this.asyncCall(CallMethod.getDeviceInfo);
|
|
825
|
+
return response.getDataOrDefault({});
|
|
826
|
+
}
|
|
802
827
|
public static async setAccessibilityEventFilters(
|
|
803
828
|
value: AccessibilityEventFilter[]
|
|
804
829
|
): Promise<any> {
|
|
@@ -884,4 +909,24 @@ export class AssistsX {
|
|
|
884
909
|
public static getAccessibilityEventListenerCount(): number {
|
|
885
910
|
return accessibilityEventListeners.length;
|
|
886
911
|
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* 发送HTTP请求
|
|
915
|
+
* @param options 请求选项
|
|
916
|
+
* @returns HTTP响应
|
|
917
|
+
*/
|
|
918
|
+
// public static async httpRequest(
|
|
919
|
+
// options: HttpRequestOptions
|
|
920
|
+
// ): Promise<HttpResponse> {
|
|
921
|
+
// const { url, method = "GET", headers, body, timeout = 30 } = options;
|
|
922
|
+
// const response = await this.asyncCall(CallMethod.httpRequest, {
|
|
923
|
+
// args: { url, method, headers, body, timeout },
|
|
924
|
+
// });
|
|
925
|
+
// return response.getDataOrDefault({
|
|
926
|
+
// statusCode: -1,
|
|
927
|
+
// statusMessage: "",
|
|
928
|
+
// body: "",
|
|
929
|
+
// headers: {},
|
|
930
|
+
// });
|
|
931
|
+
// }
|
|
887
932
|
}
|
package/src/AssistsXAsync.ts
CHANGED
|
@@ -7,7 +7,13 @@ import { CallMethod } from "./CallMethod";
|
|
|
7
7
|
import { CallResponse } from "./CallResponse";
|
|
8
8
|
import { Bounds } from "./Bounds";
|
|
9
9
|
import { generateUUID } from "./Utils";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
AssistsX,
|
|
12
|
+
callbacks,
|
|
13
|
+
WebFloatingWindowOptions,
|
|
14
|
+
HttpRequestOptions,
|
|
15
|
+
HttpResponse,
|
|
16
|
+
} from "./AssistsX";
|
|
11
17
|
|
|
12
18
|
export class AssistsXAsync {
|
|
13
19
|
/**
|
|
@@ -704,6 +710,10 @@ export class AssistsXAsync {
|
|
|
704
710
|
const response = await this.asyncCall(CallMethod.getMacAddress);
|
|
705
711
|
return response.getDataOrDefault({});
|
|
706
712
|
}
|
|
713
|
+
public static async getDeviceInfo(): Promise<any> {
|
|
714
|
+
const response = await this.asyncCall(CallMethod.getDeviceInfo);
|
|
715
|
+
return response.getDataOrDefault({});
|
|
716
|
+
}
|
|
707
717
|
|
|
708
718
|
/**
|
|
709
719
|
* 获取屏幕尺寸
|
|
@@ -722,4 +732,24 @@ export class AssistsXAsync {
|
|
|
722
732
|
const response = await this.asyncCall(CallMethod.getAppScreenSize);
|
|
723
733
|
return response.getDataOrDefault("{}");
|
|
724
734
|
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* 发送HTTP请求
|
|
738
|
+
* @param options 请求选项
|
|
739
|
+
* @returns HTTP响应
|
|
740
|
+
*/
|
|
741
|
+
// public static async httpRequest(
|
|
742
|
+
// options: HttpRequestOptions
|
|
743
|
+
// ): Promise<HttpResponse> {
|
|
744
|
+
// const { url, method = "GET", headers, body, timeout = 30 } = options;
|
|
745
|
+
// const response = await this.asyncCall(CallMethod.httpRequest, {
|
|
746
|
+
// args: { url, method, headers, body, timeout },
|
|
747
|
+
// });
|
|
748
|
+
// return response.getDataOrDefault({
|
|
749
|
+
// statusCode: -1,
|
|
750
|
+
// statusMessage: "",
|
|
751
|
+
// body: "",
|
|
752
|
+
// headers: {},
|
|
753
|
+
// });
|
|
754
|
+
// }
|
|
725
755
|
}
|
package/src/CallMethod.ts
CHANGED
|
@@ -48,6 +48,9 @@ export const CallMethod = {
|
|
|
48
48
|
|
|
49
49
|
addAccessibilityEventFilter: "addAccessibilityEventFilter",
|
|
50
50
|
setAccessibilityEventFilters: "setAccessibilityEventFilters",
|
|
51
|
+
|
|
52
|
+
httpRequest: "httpRequest",
|
|
53
|
+
getDeviceInfo: "getDeviceInfo",
|
|
51
54
|
} as const;
|
|
52
55
|
|
|
53
56
|
// 导出类型定义
|