summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBrian Maissy <brian.maissy@gmail.com>2013-03-11 11:47:40 +0200
committerBrian Maissy <brian.maissy@gmail.com>2013-03-11 11:47:40 +0200
commit4af8215b32a903b2ac2d0c60d08c9b511c4ad480 (patch)
tree9447c6ef785621b376af71a8bd3bb243daa7656c /README.md
parentf730ef5399ab19f0c116b78114809febfad3a257 (diff)
downloadasync-4af8215b32a903b2ac2d0c60d08c9b511c4ad480.tar.gz
clarified cargo documentation
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/README.md b/README.md
index 09ea6df..75b2a12 100644
--- a/README.md
+++ b/README.md
@@ -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);