summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2016-04-26 11:35:54 -0700
committerAlex Early <alexander.early@gmail.com>2016-04-26 11:35:54 -0700
commit1114e65d1e58abcf420d2f4cbb8ea413ded49859 (patch)
tree1676b6e8043901fe470b047052e52fc2c8e3d9d2
parenta50b252794979c66ecb75e8f33cac882c1019ef0 (diff)
parent5adcc6b4c7f9f20265333df2e35c329e5b242136 (diff)
downloadasync-1114e65d1e58abcf420d2f4cbb8ea413ded49859.tar.gz
Merge pull request #1129 from WaeCo/patch-1
Updated description of during #1121
-rw-r--r--README.md14
1 files changed, 11 insertions, 3 deletions
diff --git a/README.md b/README.md
index e7a4c1a..30c8115 100644
--- a/README.md
+++ b/README.md
@@ -956,18 +956,26 @@ Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument o
Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error.
+Additionaly `during` passes any arguments passed by the iteratee function (2nd function) to the test function (1st function). The test callback will allways be the last parameter.
+
__Example__
```js
var count = 0;
async.during(
- function (callback) {
- return callback(null, count < 5);
+ function (result, callback) {
+ if(!callback) {
+ callback = result;
+ result = null;
+ }
+ return callback(null, !result || result.counter < 5);
},
function (callback) {
count++;
- setTimeout(callback, 1000);
+ setTimeout(function() {
+ callback(null, { counter: count });
+ }, 1000);
},
function (err) {
// 5 seconds have passed