summaryrefslogtreecommitdiff
path: root/lib/forever.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/forever.js')
-rw-r--r--lib/forever.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/forever.js b/lib/forever.js
index 0147395..f7be0b2 100644
--- a/lib/forever.js
+++ b/lib/forever.js
@@ -2,21 +2,22 @@ import noop from 'lodash/noop';
import onlyOnce from './internal/onlyOnce';
import ensureAsync from './ensureAsync';
+import wrapAsync from './internal/wrapAsync';
/**
* 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.
+ * If an error is passed to the callback then `errback` is called with the
+ * error, and execution stops, otherwise it will never be called.
*
* @name forever
* @static
* @memberOf module:ControlFlow
* @method
* @category Control Flow
- * @param {Function} fn - a function to call repeatedly. Invoked with (next).
+ * @param {AsyncFunction} fn - an async function to call repeatedly.
+ * Invoked with (next).
* @param {Function} [errback] - when `fn` passes an error to it's callback,
* this function will be called, and execution stops. Invoked with (err).
* @example
@@ -34,7 +35,7 @@ import ensureAsync from './ensureAsync';
*/
export default function forever(fn, errback) {
var done = onlyOnce(errback || noop);
- var task = ensureAsync(fn);
+ var task = wrapAsync(ensureAsync(fn));
function next(err) {
if (err) return done(err);