Skip to content
On this page

useAsyncOrder

Hook to manage the execution order of asynchronous tasks

Code demonstration

Basic usage

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

PropertyDescriptionType
taskaynchronous task order queue((resolve?: Resolve,reject?: InterruptibleRejectType,index?: number) => void)[]
optionoption-

Option

PropertyDescriptionType
delayDelay executionnumber
onReadyPreparation phase callbackvoid
onSuccessSuccessful callback(result: unknown) => void
onErrorError callback(err: unknown) => void

Source

SourceDocsDemo