@zwa73/utils 1.0.45 → 1.0.46

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.
@@ -51,6 +51,13 @@ export declare namespace UtilFunc {
51
51
  }>;
52
52
  /**获得一个永不完成的Promise单例 */
53
53
  function getNeverResolvedPromise<T>(): Promise<T>;
54
- /**重复尝试promise */
54
+ /**重复尝试promise
55
+ * @async
56
+ * @param {PromiseProcFn<T>} [procFn] - 发起函数
57
+ * @param {PromiseVerifyFn<T>} [verifyFn] - 验证函数
58
+ * @param {number} [repeatCount] - 重试次数
59
+ * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
60
+ * @returns {Promise<T|null>} - 结果 null 为全部失败/超时
61
+ */
55
62
  function repeatPromise<T>(procFn: PromiseProcFn<T>, verifyFn?: PromiseVerifyFn<T>, repeatCount?: number, repeatTime?: number): Promise<T | null>;
56
63
  }
@@ -99,7 +99,14 @@ var UtilFunc;
99
99
  return NeverResolvedPromise;
100
100
  }
101
101
  UtilFunc.getNeverResolvedPromise = getNeverResolvedPromise;
102
- /**重复尝试promise */
102
+ /**重复尝试promise
103
+ * @async
104
+ * @param {PromiseProcFn<T>} [procFn] - 发起函数
105
+ * @param {PromiseVerifyFn<T>} [verifyFn] - 验证函数
106
+ * @param {number} [repeatCount] - 重试次数
107
+ * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
108
+ * @returns {Promise<T|null>} - 结果 null 为全部失败/超时
109
+ */
103
110
  async function repeatPromise(procFn, verifyFn, repeatCount = 3, repeatTime = 180) {
104
111
  //转换为毫秒
105
112
  const hasRepeatTime = (repeatTime >= 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "my utils",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -98,7 +98,14 @@ export function getNeverResolvedPromise<T>():Promise<T>{
98
98
  return NeverResolvedPromise as Promise<T>;
99
99
  }
100
100
 
101
- /**重复尝试promise */
101
+ /**重复尝试promise
102
+ * @async
103
+ * @param {PromiseProcFn<T>} [procFn] - 发起函数
104
+ * @param {PromiseVerifyFn<T>} [verifyFn] - 验证函数
105
+ * @param {number} [repeatCount] - 重试次数
106
+ * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
107
+ * @returns {Promise<T|null>} - 结果 null 为全部失败/超时
108
+ */
102
109
  export async function repeatPromise<T>(procFn:PromiseProcFn<T>,verifyFn?:PromiseVerifyFn<T>,
103
110
  repeatCount:number=3,repeatTime:number=180):Promise<T|null>{
104
111
  //转换为毫秒