source: imaps-frontend/node_modules/fastq/index.d.ts@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1declare function fastq<C, T = any, R = any>(context: C, worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
2declare function fastq<C, T = any, R = any>(worker: fastq.worker<C, T, R>, concurrency: number): fastq.queue<T, R>
3
4declare 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 running(): number
16 idle(): boolean
17 length(): number
18 getQueue(): T[]
19 kill(): any
20 killAndDrain(): any
21 error(handler: errorHandler<T>): void
22 concurrency: number
23 drain(): any
24 empty: () => void
25 saturated: () => void
26 }
27
28 interface queueAsPromised<T = any, R = any> extends queue<T, R> {
29 push(task: T): Promise<R>
30 unshift(task: T): Promise<R>
31 drained(): Promise<void>
32 }
33
34 function promise<C, T = any, R = any>(context: C, worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
35 function promise<C, T = any, R = any>(worker: fastq.asyncWorker<C, T, R>, concurrency: number): fastq.queueAsPromised<T, R>
36}
37
38export = fastq
Note: See TracBrowser for help on using the repository browser.