source: trip-planner-front/node_modules/fastq/index.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • 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 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
37export = fastq
Note: See TracBrowser for help on using the repository browser.