Skip to content
On this page

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

Source

源码文档示例