Merge pull request #2302 from jozefizso/feature_async_queue_push

Added queue.push() method overload for strongly typed queues
This commit is contained in:
Masahiro Wakame
2014-06-10 15:47:20 +09:00
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -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) { },
+1
View File
@@ -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>;