diff options
author | Brian Maissy <brian.maissy@gmail.com> | 2013-03-11 11:47:40 +0200 |
---|---|---|
committer | Brian Maissy <brian.maissy@gmail.com> | 2013-03-11 11:47:40 +0200 |
commit | 4af8215b32a903b2ac2d0c60d08c9b511c4ad480 (patch) | |
tree | 9447c6ef785621b376af71a8bd3bb243daa7656c /README.md | |
parent | f730ef5399ab19f0c116b78114809febfad3a257 (diff) | |
download | async-4af8215b32a903b2ac2d0c60d08c9b511c4ad480.tar.gz |
clarified cargo documentation
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -979,9 +979,9 @@ the worker has completed some tasks, each callback of those tasks is called. __Arguments__ -* worker(tasks, callback) - An asynchronous function for processing queued - tasks, which must call its callback(err) argument when finished, with an - optional error as an argument. +* worker(tasks, callback) - An asynchronous function for processing an array of + queued tasks, which must call its callback(err) argument when finished, with + an optional error as an argument. * payload - An optional integer for determining how many tasks should be processed per round; if omitted, the default is unlimited. @@ -1006,8 +1006,10 @@ __Example__ ```js // create a cargo object with payload 2 -var cargo = async.cargo(function (task, callback) { - console.log('hello ' + task.name); +var cargo = async.cargo(function (tasks, callback) { + for(var i=0; i<tasks.length; i++){ + console.log('hello ' + task[i].name); + } callback(); }, 2); |