Constructors
constructor
- new D4C(queuesParam?: Array<{ concurrency: { limit?: number; tag?: string | symbol } }>): D4C
-
Parameters
-
Optional queuesParam: Array<{ concurrency: { limit?: number; tag?: string | symbol } }>
Returns D4C
Methods
apply
- apply<T>(func: T, option?: { args?: Parameters<typeof func>; dropWhenReachLimit?: boolean; inheritPreErr?: boolean; noBlockCurr?: boolean; tag?: string | symbol }): Promise<UnwrapPromise<typeof func>>
-
Type parameters
Parameters
-
func: T
-
Optional option: { args?: Parameters<typeof func>; dropWhenReachLimit?: boolean; inheritPreErr?: boolean; noBlockCurr?: boolean; tag?: string | symbol }
-
Optional args?: Parameters<typeof func>
-
Optional dropWhenReachLimit?: boolean
-
Optional inheritPreErr?: boolean
-
Optional noBlockCurr?: boolean
-
Optional tag?: string | symbol
Returns Promise<UnwrapPromise<typeof func>>
setConcurrency
- setConcurrency(queuesParam: Array<{ limit: number; tag?: string | symbol }>): void
-
Parameters
-
queuesParam: Array<{ limit: number; tag?: string | symbol }>
Returns void
wrap
- wrap<T>(func: T, option?: { dropWhenReachLimit?: boolean; inheritPreErr?: boolean; noBlockCurr?: boolean; tag?: string | symbol }): (...args: Parameters<typeof func>) => Promise<UnwrapPromise<typeof func>>
-
Type parameters
Parameters
-
func: T
-
Optional option: { dropWhenReachLimit?: boolean; inheritPreErr?: boolean; noBlockCurr?: boolean; tag?: string | symbol }
-
Optional dropWhenReachLimit?: boolean
-
Optional inheritPreErr?: boolean
-
Optional noBlockCurr?: boolean
-
Optional tag?: string | symbol
Returns (...args: Parameters<typeof func>) => Promise<UnwrapPromise<typeof func>>
-
- (...args: Parameters<typeof func>): Promise<UnwrapPromise<typeof func>>
-
Parameters
-
Rest ...args: Parameters<typeof func>
Returns Promise<UnwrapPromise<typeof func>>
Default concurrency is 1. Omitting tag means it is for default queue. If you specify concurrency limit for some tag queue, this instance will not use that tag queue by default.