File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,30 @@ export interface GetAsyncTaskReturn {
23
23
* @param request 请求函数
24
24
* @param option 选项 rules:判断条件 params:请求参数 asyncTime:异步时间 maxTimes:最大次数
25
25
* @returns { task, stop } task:异步任务 stop:停止异步任务
26
+ * @example
27
+ * ```
28
+ * // rules:判断条件
29
+ * // 1.请求接口放回数据后,判断返回数据中code为200,且data.complete为true
30
+ * // {
31
+ * // code: 200,
32
+ * // data: {
33
+ * // complete: true
34
+ * // }
35
+ * // }
36
+ * const rules = [
37
+ * {
38
+ * keys: "code",
39
+ * val: 200,
40
+ * },
41
+ * {
42
+ * keys: ["data", "complete"],
43
+ * val: true,
44
+ * }
45
+ * ];
46
+ * const params = {};
47
+ * const { task } = getAsyncTask(asyncTaskApi, { rules, params });
48
+ *
49
+ * ```
26
50
*/
27
51
export function getAsyncTask ( request : Awaitable < any > , option : GetAsyncTaskOptions ) : GetAsyncTaskReturn {
28
52
let timer : string | number | NodeJS . Timeout | undefined
You can’t perform that action at this time.
0 commit comments