[6a3a178] | 1 | declare function fastq<C, T = any, R = any>(context: C, worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
|
---|
| 2 | declare function fastq<C, T = any, R = any>(worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
|
---|
| 3 |
|
---|
| 4 | declare namespace fastq {
|
---|
| 5 | type worker<C, T = any, R = any> = (this: C, task: T, cb: fastq.done<R>) => void
|
---|
| 6 | type asyncWorker<C, T = any, R = any> = (this: C, task: T) => Promise<R>
|
---|
| 7 | type done<R = any> = (err: Error | null, result?: R) => void
|
---|
| 8 | type errorHandler<T = any> = (err: Error, task: T) => void
|
---|
| 9 |
|
---|
| 10 | interface queue<T = any, R = any> {
|
---|
| 11 | push(task: T, done?: done<R>): void
|
---|
| 12 | unshift(task: T, done?: done<R>): void
|
---|
| 13 | pause(): any
|
---|
| 14 | resume(): any
|
---|
| 15 | idle(): boolean
|
---|
| 16 | length(): number
|
---|
| 17 | getQueue(): T[]
|
---|
| 18 | kill(): any
|
---|
| 19 | killAndDrain(): any
|
---|
| 20 | error(handler: errorHandler): void
|
---|
| 21 | concurrency: number
|
---|
| 22 | drain(): any
|
---|
| 23 | empty: () => void
|
---|
| 24 | saturated: () => void
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | interface queueAsPromised<T = any, R = any> extends queue<T, R> {
|
---|
| 28 | push(task: T): Promise<R>
|
---|
| 29 | unshift(task: T): Promise<R>
|
---|
| 30 | drained(): Promise<void>
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | function promise<C, T = any, R = any>(context: C, worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
|
---|
| 34 | function promise<C, T = any, R = any>(worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | export = fastq
|
---|