ms-types 0.1.17 → 0.1.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/types/action.d.ts CHANGED
@@ -236,7 +236,7 @@ declare namespace action {
236
236
  * @returns 执行是否成功
237
237
  * @example const success = builder.execute()
238
238
  */
239
- execute(): boolean;
239
+ execute(): boolean | Promise<boolean>;
240
240
  }
241
241
 
242
242
  /**
package/types/device.d.ts CHANGED
@@ -101,5 +101,5 @@ declare namespace device {
101
101
  * @param intensity 强度 0.0-1.0
102
102
  * @example device.vibrate(1000, 0.5)
103
103
  */
104
- function vibrate(duration: number, intensity: number): void;
104
+ function vibrate(duration: number, intensity: number): void | Promise<void>;
105
105
  }
package/types/global.d.ts CHANGED
@@ -59,13 +59,14 @@ declare const __package__: {
59
59
  };
60
60
 
61
61
  /**
62
- * 设置异步模式 设置为异步模式后,方法所有同步API方法都会返回 Promise 异步执行
62
+ * 设置异步模式 设置为异步模式后,方法定义的返回值有 `Promise` 的 `API` 方法都会返回 Promise 异步执行
63
+ * 必须写在 main 方法第一行
63
64
  * @param asyncMode 是否异步模式
64
65
  * @description 设置是否开启异步模式,默认 false
65
66
  * @example
66
67
  * setAsyncMode(true);
67
68
  */
68
- declare function setAsyncMode(...args: any[]): void;
69
+ declare function setAsyncMode(asyncMode: boolean): void;
69
70
 
70
71
  /**
71
72
  * 设置停止回调(仅主线程调用)
package/types/node.d.ts CHANGED
@@ -156,6 +156,15 @@ declare class NodeSelector {
156
156
  * @returns 节点信息
157
157
  */
158
158
  getOneNodeInfo(timeout?: number): NodeInfo | null;
159
+ /**
160
+ * 加载节点数据
161
+ * @param timeout 超时时间,单位毫秒 默认为 5000 毫秒
162
+ */
163
+ loadNode(timeout?: number): NodeSelector;
164
+ /**
165
+ * 清除所有选择条件
166
+ */
167
+ clearSelector(): NodeSelector;
159
168
  /**
160
169
  * 获取节点xpath
161
170
  * @param path xpath路径
@@ -58,6 +58,16 @@ declare const $脚本配置: {
58
58
  [key: 字符串]: 任意类型;
59
59
  };
60
60
 
61
+ /**
62
+ * 设置异步模式 设置为异步模式后,方法定义的返回值有 `Promise` 的 `API` 方法都会返回 Promise 异步执行
63
+ * 必须写在 main 方法第一行
64
+ * @param 异步模式 是否异步模式
65
+ * @description 设置是否开启异步模式,默认 false
66
+ * @example
67
+ * $设置异步模式(true);
68
+ */
69
+ declare function $设置异步模式(异步模式: 布尔值): 无返回值;
70
+
61
71
  /**
62
72
  * 设置停止回调(仅主线程调用)
63
73
  * @param callback 停止回调
@@ -96,7 +106,7 @@ declare const $重启脚本: (延迟时间: 数字) => 无返回值;
96
106
  * @example
97
107
  * $延时(1000);
98
108
  */
99
- declare const $延时: (毫秒: 数字) => 无返回值;
109
+ declare const $延时: (毫秒: 数字) => 无返回值 | Promise<无返回值>;
100
110
 
101
111
  /**
102
112
  * 退出脚本
@@ -238,7 +238,7 @@ declare namespace $动作 {
238
238
  * @returns 执行是否成功
239
239
  * @example const 是否成功 = 动作构建器.执行()
240
240
  */
241
- 执行(): 布尔值;
241
+ 执行(): 布尔值 | Promise<布尔值>;
242
242
  }
243
243
 
244
244
  /**
@@ -157,6 +157,15 @@ declare class $节点选择器 {
157
157
  * @returns 节点信息
158
158
  */
159
159
  获取一个节点(超时时间?: 数字): $节点信息 | null;
160
+ /**
161
+ * 加载节点数据
162
+ * @param 超时时间,单位毫秒 默认为 5000 毫秒
163
+ */
164
+ 加载节点数据(超时时间?: 数字): $节点选择器;
165
+ /**
166
+ * 清除所有选择条件
167
+ */
168
+ 清除所有选择条件(): $节点选择器;
160
169
  /**
161
170
  * 获取节点xpath
162
171
  * @param xpath 节点xpath路径
@@ -102,5 +102,5 @@ declare namespace $设备 {
102
102
  * @param 强度 强度 0.0-1.0
103
103
  * @example $设备.震动(1000, 0.5)
104
104
  */
105
- function 震动(持续时间: 数字, 强度: 数字): 无返回值;
105
+ function 震动(持续时间: 数字, 强度: 数字): 无返回值 | Promise<无返回值>;
106
106
  }