mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
http://caolan.github.io/async/v3/docs.html#cargo http://caolan.github.io/async/v3/docs.html#QueueObject Thanks!
This commit is contained in:
committed by
Ben Lichtman
parent
5062ff431f
commit
b8a56bd21b
Vendored
+6
-1
@@ -106,7 +106,12 @@ export interface AsyncCargo {
|
||||
push(task: any, callback?: Function): void;
|
||||
saturated(): void;
|
||||
empty(): void;
|
||||
drain(): void;
|
||||
/**
|
||||
* a function that sets a callback that is called when the last item from the queue has returned from the worker.
|
||||
* If the callback is omitted, q.drain() returns a promise for the next occurrence.
|
||||
*/
|
||||
drain(): Promise<void>;
|
||||
drain(handler: () => void): void;
|
||||
idle(): boolean;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
|
||||
@@ -256,6 +256,8 @@ const cargo = async.cargo((tasks, callback) => {
|
||||
}
|
||||
callback();
|
||||
}, 2);
|
||||
cargo.drain(); // $ExpectType Promise<void>
|
||||
cargo.drain(() => { console.log('done processing queue'); }); // $ExpectType void
|
||||
|
||||
// add some items
|
||||
cargo.push({ name: 'foo' }, (err: Error) => { console.log('finished processing foo'); });
|
||||
|
||||
Reference in New Issue
Block a user