assistsx-js 0.0.2029 → 0.0.2031

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.
@@ -127,6 +127,19 @@ export declare class AssistsX {
127
127
  * @returns 剪贴板最新文本
128
128
  */
129
129
  static getClipboardLatestText(): any;
130
+ /**
131
+ * 在浏览器中打开URL
132
+ * @param url 要打开的URL
133
+ * @returns 是否成功打开
134
+ */
135
+ static openUrlInBrowser(url: string): boolean;
136
+ /**
137
+ * 保持屏幕常亮
138
+ * @param tip 提示文本
139
+ * @returns 是否保持屏幕常亮成功
140
+ */
141
+ static keepScreenOn(tip?: string): boolean;
142
+ static clearKeepScreenOn(): boolean;
130
143
  static isAppInstalled(packageName: string): boolean;
131
144
  /**
132
145
  * 对指定节点进行截图
package/dist/AssistsX.js CHANGED
@@ -169,6 +169,32 @@ export class AssistsX {
169
169
  const response = this.call(CallMethod.getClipboardLatestText);
170
170
  return response.getDataOrDefault({});
171
171
  }
172
+ /**
173
+ * 在浏览器中打开URL
174
+ * @param url 要打开的URL
175
+ * @returns 是否成功打开
176
+ */
177
+ static openUrlInBrowser(url) {
178
+ const response = this.call(CallMethod.openUrlInBrowser, {
179
+ args: { url },
180
+ });
181
+ return response.getDataOrDefault(false);
182
+ }
183
+ /**
184
+ * 保持屏幕常亮
185
+ * @param tip 提示文本
186
+ * @returns 是否保持屏幕常亮成功
187
+ */
188
+ static keepScreenOn(tip) {
189
+ const response = this.call(CallMethod.keepScreenOn, {
190
+ args: { tip },
191
+ });
192
+ return response.getDataOrDefault(false);
193
+ }
194
+ static clearKeepScreenOn() {
195
+ const response = this.call(CallMethod.clearKeepScreenOn, {});
196
+ return response.getDataOrDefault(false);
197
+ }
172
198
  static isAppInstalled(packageName) {
173
199
  const response = this.call(CallMethod.isAppInstalled, {
174
200
  args: { packageName },
@@ -373,4 +373,11 @@ export declare class AssistsXAsync {
373
373
  * @returns 应用窗口尺寸对象
374
374
  */
375
375
  static getAppScreenSize(timeout?: number): Promise<any>;
376
+ /**
377
+ * 在浏览器中打开URL
378
+ * @param url 要打开的URL
379
+ * @param timeout 超时时间(秒),默认30秒
380
+ * @returns 是否成功打开
381
+ */
382
+ static openUrlInBrowser(url: string, timeout?: number): Promise<boolean>;
376
383
  }
@@ -625,4 +625,17 @@ export class AssistsXAsync {
625
625
  });
626
626
  return response.getDataOrDefault("{}");
627
627
  }
628
+ /**
629
+ * 在浏览器中打开URL
630
+ * @param url 要打开的URL
631
+ * @param timeout 超时时间(秒),默认30秒
632
+ * @returns 是否成功打开
633
+ */
634
+ static async openUrlInBrowser(url, timeout) {
635
+ const response = await this.asyncCall(CallMethod.openUrlInBrowser, {
636
+ args: { url },
637
+ timeout,
638
+ });
639
+ return response.getDataOrDefault(false);
640
+ }
628
641
  }
@@ -49,5 +49,8 @@ export declare const CallMethod: {
49
49
  readonly getNetworkType: "getNetworkType";
50
50
  readonly isAppInstalled: "isAppInstalled";
51
51
  readonly getClipboardLatestText: "getClipboardLatestText";
52
+ readonly openUrlInBrowser: "openUrlInBrowser";
53
+ readonly keepScreenOn: "keepScreenOn";
54
+ readonly clearKeepScreenOn: "clearKeepScreenOn";
52
55
  };
53
56
  export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
@@ -50,4 +50,7 @@ export const CallMethod = {
50
50
  getNetworkType: "getNetworkType",
51
51
  isAppInstalled: "isAppInstalled",
52
52
  getClipboardLatestText: "getClipboardLatestText",
53
+ openUrlInBrowser: "openUrlInBrowser",
54
+ keepScreenOn: "keepScreenOn",
55
+ clearKeepScreenOn: "clearKeepScreenOn",
53
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2029",
3
+ "version": "0.0.2031",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -266,6 +266,33 @@ export class AssistsX {
266
266
  return response.getDataOrDefault({});
267
267
  }
268
268
 
269
+ /**
270
+ * 在浏览器中打开URL
271
+ * @param url 要打开的URL
272
+ * @returns 是否成功打开
273
+ */
274
+ public static openUrlInBrowser(url: string): boolean {
275
+ const response = this.call(CallMethod.openUrlInBrowser, {
276
+ args: { url },
277
+ });
278
+ return response.getDataOrDefault(false);
279
+ }
280
+
281
+ /**
282
+ * 保持屏幕常亮
283
+ * @param tip 提示文本
284
+ * @returns 是否保持屏幕常亮成功
285
+ */
286
+ public static keepScreenOn(tip?: string): boolean {
287
+ const response = this.call(CallMethod.keepScreenOn, {
288
+ args: { tip },
289
+ });
290
+ return response.getDataOrDefault(false);
291
+ }
292
+ public static clearKeepScreenOn(): boolean {
293
+ const response = this.call(CallMethod.clearKeepScreenOn, {});
294
+ return response.getDataOrDefault(false);
295
+ }
269
296
  public static isAppInstalled(packageName: string): boolean {
270
297
  const response = this.call(CallMethod.isAppInstalled, {
271
298
  args: { packageName },
@@ -899,6 +899,23 @@ export class AssistsXAsync {
899
899
  return response.getDataOrDefault("{}");
900
900
  }
901
901
 
902
+ /**
903
+ * 在浏览器中打开URL
904
+ * @param url 要打开的URL
905
+ * @param timeout 超时时间(秒),默认30秒
906
+ * @returns 是否成功打开
907
+ */
908
+ public static async openUrlInBrowser(
909
+ url: string,
910
+ timeout?: number
911
+ ): Promise<boolean> {
912
+ const response = await this.asyncCall(CallMethod.openUrlInBrowser, {
913
+ args: { url },
914
+ timeout,
915
+ });
916
+ return response.getDataOrDefault(false);
917
+ }
918
+
902
919
  /**
903
920
  * 发送HTTP请求
904
921
  * @param options 请求选项
package/src/CallMethod.ts CHANGED
@@ -54,6 +54,9 @@ export const CallMethod = {
54
54
  getNetworkType: "getNetworkType",
55
55
  isAppInstalled: "isAppInstalled",
56
56
  getClipboardLatestText: "getClipboardLatestText",
57
+ openUrlInBrowser: "openUrlInBrowser",
58
+ keepScreenOn: "keepScreenOn",
59
+ clearKeepScreenOn: "clearKeepScreenOn",
57
60
  } as const;
58
61
 
59
62
  // 导出类型定义