mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #2302 from jozefizso/feature_async_queue_push
Added queue.push() method overload for strongly typed queues
This commit is contained in:
@@ -156,6 +156,22 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) {
|
||||
console.log('finished processing bar');
|
||||
});
|
||||
|
||||
// tests for strongly typed tasks
|
||||
var q2 = async.queue(function (task: string, callback) {
|
||||
console.log('Task: ' + task);
|
||||
callback();
|
||||
}, 1);
|
||||
|
||||
q2.push('task1');
|
||||
|
||||
q2.push('task2', function (error, results: string[]) {
|
||||
console.log('Finished tasks: ' + results.join(', '));
|
||||
});
|
||||
|
||||
q2.push(['task3', 'task4', 'task5'], function (error, results: string[]) {
|
||||
console.log('Finished tasks: ' + results.join(', '));
|
||||
});
|
||||
|
||||
var filename = '';
|
||||
async.auto({
|
||||
get_data: function (callback) { },
|
||||
|
||||
Vendored
+1
@@ -16,6 +16,7 @@ interface AsyncQueue<T> {
|
||||
length(): number;
|
||||
concurrency: number;
|
||||
push(task: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
saturated: AsyncMultipleResultsCallback<T>;
|
||||
empty: AsyncMultipleResultsCallback<T>;
|
||||
drain: AsyncMultipleResultsCallback<T>;
|
||||
|
||||
Reference in New Issue
Block a user