summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolan McMahon <caolan@caolanmcmahon.com>2014-03-28 12:39:58 +0000
committerCaolan McMahon <caolan@caolanmcmahon.com>2014-03-28 12:39:58 +0000
commitf8cb033c279dc06504cefca66b17c1117b9dcf26 (patch)
tree0a815dde165d6563fe0fcba522bed5c8d14186d0
parent1346453cd2b4b8831f7765bac703ac63a3f9f124 (diff)
parenteea14ed194dff46540eee196400acdfc0c8b7480 (diff)
downloadasync-f8cb033c279dc06504cefca66b17c1117b9dcf26.tar.gz
Merge remote-tracking branch 'kybernetikos/patch-1'
Conflicts: README.md
-rw-r--r--README.md23
1 files changed, 19 insertions, 4 deletions
diff --git a/README.md b/README.md
index 0ae4f5c..c093f7b 100644
--- a/README.md
+++ b/README.md
@@ -804,11 +804,26 @@ Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument o
---------------------------------------
<a name="forever" />
-### forever(fn, callback)
+### forever(fn, errback)
-Calls the asynchronous function `fn` repeatedly, in series, indefinitely.
-If an error is passed to `fn`'s callback, then `callback` is called with the
-error; otherwise it is never called.
+Calls the asynchronous function `fn` with a callback parameter that allows it to
+call itself again, in series, indefinitely.
+
+If an error is passed to the callback then `errback` is called with the
+error, and execution stops, otherwise it will never be called.
+
+```js
+async.forever(
+ function(next) {
+ // next is suitable for passing to things that need a callback(err [, whatever]);
+ // it will result in this function being called again.
+ },
+ function(err) {
+ // if next is called with a value in its first parameter, it will appear
+ // in here as 'err', and execution will stop.
+ }
+);
+```
---------------------------------------