assistsx-js 0.1.28 → 0.1.29

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.
@@ -112,6 +112,12 @@ export declare class AssistsX {
112
112
  * @returns 剪贴板最新文本
113
113
  */
114
114
  static getClipboardLatestText(): any;
115
+ /**
116
+ * 获取剪贴板文本内容(异步)
117
+ * @param timeout 超时时间(秒),默认30秒
118
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
119
+ */
120
+ static getClipboardText(timeout?: number): Promise<string>;
115
121
  /**
116
122
  * 在浏览器中打开URL
117
123
  * @param url 要打开的URL
package/dist/AssistsX.js CHANGED
@@ -174,6 +174,18 @@ export class AssistsX {
174
174
  const response = this.call(CallMethod.getClipboardLatestText);
175
175
  return response.getDataOrDefault({});
176
176
  }
177
+ /**
178
+ * 获取剪贴板文本内容(异步)
179
+ * @param timeout 超时时间(秒),默认30秒
180
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
181
+ */
182
+ static async getClipboardText(timeout) {
183
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
184
+ timeout,
185
+ });
186
+ const data = response.getDataOrDefault({ text: "" });
187
+ return data.text || "";
188
+ }
177
189
  /**
178
190
  * 在浏览器中打开URL
179
191
  * @param url 要打开的URL
@@ -517,4 +517,10 @@ export declare class AssistsXAsync {
517
517
  prettyPrint?: boolean;
518
518
  timeout?: number;
519
519
  }): Promise<string>;
520
+ /**
521
+ * 获取剪贴板文本内容
522
+ * @param timeout 超时时间(秒),默认30秒
523
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
524
+ */
525
+ static getClipboardText(timeout?: number): Promise<string>;
520
526
  }
@@ -843,4 +843,16 @@ export class AssistsXAsync {
843
843
  const data = response.getDataOrDefault({ file: "" });
844
844
  return data.file;
845
845
  }
846
+ /**
847
+ * 获取剪贴板文本内容
848
+ * @param timeout 超时时间(秒),默认30秒
849
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
850
+ */
851
+ static async getClipboardText(timeout) {
852
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
853
+ timeout,
854
+ });
855
+ const data = response.getDataOrDefault({ text: "" });
856
+ return data.text || "";
857
+ }
846
858
  }
@@ -52,6 +52,7 @@ export declare const CallMethod: {
52
52
  readonly getNetworkType: "getNetworkType";
53
53
  readonly isAppInstalled: "isAppInstalled";
54
54
  readonly getClipboardLatestText: "getClipboardLatestText";
55
+ readonly getClipboardText: "getClipboardText";
55
56
  readonly openUrlInBrowser: "openUrlInBrowser";
56
57
  readonly keepScreenOn: "keepScreenOn";
57
58
  readonly clearKeepScreenOn: "clearKeepScreenOn";
@@ -53,6 +53,7 @@ export const CallMethod = {
53
53
  getNetworkType: "getNetworkType",
54
54
  isAppInstalled: "isAppInstalled",
55
55
  getClipboardLatestText: "getClipboardLatestText",
56
+ getClipboardText: "getClipboardText",
56
57
  openUrlInBrowser: "openUrlInBrowser",
57
58
  keepScreenOn: "keepScreenOn",
58
59
  clearKeepScreenOn: "clearKeepScreenOn",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -257,6 +257,19 @@ export class AssistsX {
257
257
  return response.getDataOrDefault({});
258
258
  }
259
259
 
260
+ /**
261
+ * 获取剪贴板文本内容(异步)
262
+ * @param timeout 超时时间(秒),默认30秒
263
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
264
+ */
265
+ public static async getClipboardText(timeout?: number): Promise<string> {
266
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
267
+ timeout,
268
+ });
269
+ const data = response.getDataOrDefault({ text: "" });
270
+ return data.text || "";
271
+ }
272
+
260
273
  /**
261
274
  * 在浏览器中打开URL
262
275
  * @param url 要打开的URL
@@ -1280,6 +1280,19 @@ export class AssistsXAsync {
1280
1280
  return data.file;
1281
1281
  }
1282
1282
 
1283
+ /**
1284
+ * 获取剪贴板文本内容
1285
+ * @param timeout 超时时间(秒),默认30秒
1286
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
1287
+ */
1288
+ public static async getClipboardText(timeout?: number): Promise<string> {
1289
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
1290
+ timeout,
1291
+ });
1292
+ const data = response.getDataOrDefault({ text: "" });
1293
+ return data.text || "";
1294
+ }
1295
+
1283
1296
  /**
1284
1297
  * 发送HTTP请求
1285
1298
  * @param options 请求选项
package/src/CallMethod.ts CHANGED
@@ -57,6 +57,7 @@ export const CallMethod = {
57
57
  getNetworkType: "getNetworkType",
58
58
  isAppInstalled: "isAppInstalled",
59
59
  getClipboardLatestText: "getClipboardLatestText",
60
+ getClipboardText: "getClipboardText",
60
61
  openUrlInBrowser: "openUrlInBrowser",
61
62
  keepScreenOn: "keepScreenOn",
62
63
  clearKeepScreenOn: "clearKeepScreenOn",