useAsyncOrder
管理 异步任务 执行顺序的 Hook
代码演示
基本用法
API
useAsyncOrder({
task: ((
resolve?: Resolve,
reject?: InterruptibleRejectType,
index?: number
) => void)[]
option?: {
delay?: number
onReady?: () => void
onSuccess?: (result: unknown) => void
onError?: (err: unknown) => void
}})
useAsyncOrder({
task: ((
resolve?: Resolve,
reject?: InterruptibleRejectType,
index?: number
) => void)[]
option?: {
delay?: number
onReady?: () => void
onSuccess?: (result: unknown) => void
onError?: (err: unknown) => void
}})
Params
参数 | 说明 | 类型 |
---|---|---|
task | 异步任务顺序队列 | ((resolve?: Resolve,reject?: InterruptibleRejectType,index?: number) => void)[] |
option | 配置项 | - |
Option
参数 | 说明 | 类型 |
---|---|---|
delay | 延迟执行 | number |
onReady | 准备阶段回调 | void |
onSuccess | 成功回调 | (result: unknown) => void |
onError | 错误回调 | (err: unknown) => void |