ms-types 0.1.16 → 0.1.18

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.16",
3
+ "version": "0.1.18",
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
@@ -60,12 +60,13 @@ declare const __package__: {
60
60
 
61
61
  /**
62
62
  * 设置异步模式 设置为异步模式后,方法所有同步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
  * 设置停止回调(仅主线程调用)
@@ -107,7 +108,7 @@ declare function restartScript(delay: number): void;
107
108
  * @example
108
109
  * sleep(1000);
109
110
  */
110
- declare function sleep(ms: number): void;
111
+ declare function sleep(ms: number): void | Promise<void>;
111
112
 
112
113
  /**
113
114
  * 退出脚本
@@ -58,6 +58,16 @@ declare const $脚本配置: {
58
58
  [key: 字符串]: 任意类型;
59
59
  };
60
60
 
61
+ /**
62
+ * 设置异步模式 设置为异步模式后,方法所有同步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
  /**
@@ -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
  }