Options
All
  • Public
  • Public/Protected
  • All
Menu

Class D4C

Hierarchy

  • D4C

Index

Constructors

Methods

Constructors

constructor

  • new D4C(queuesParam?: Array<{ concurrency: { limit?: number; tag?: string | symbol } }>): D4C
  • 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.

    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>>
  • It wraps original function for queue ready and executes it

    Type parameters

    • T: IAnyFn

    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>>
  • It wraps original function for queue ready

    Type parameters

    • T: IAnyFn

    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>>

Generated using TypeDoc