blob: 25dd70b25c3138d0e0e8b4f79b52890410810b55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
var noop = require('async.util.noop');
var onlyOnce = require('async.util.onlyonce');
var ensureAsync = require('async.util.ensureasync');
module.exports = function forever(fn, cb) {
var done = onlyOnce(cb || noop);
var task = ensureAsync(fn);
function next(err) {
if (err) return done(err);
task(next);
}
next();
};
|