summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.
+ }
+);
+```
---------------------------------------