var defaults = require('./defaults');

var defaultOptions = {
    retries: 10,
    delay: 1000
};

/**
 * function download(url, filename, callback) {
 *     var operation = retry.attemps(function() {
 *         ...
 *         if (error) {
 *             if (operation.retry()) {
 *                 return;
 *             }
 *             throw new Error([url, body]);
 *         }
 *         ...
 *     });
 * }
 */
module.exports.attemps = function attemps(fn, options) {
    var task = {
        fn: fn,
        options: defaults(options || {}, defaultOptions),
        count: 0
    };
    
    task.retry = function() {
        if (task.count++ >= task.options.retries) {
            return false;
        }
        setTimeout(task.fn, task.options.delay);
        return true;
    };
    
    fn();
    
    return task;
};

@@ -76,21 +76,24 @@
 10,%0A    
-delay
+interval
 : 1000%0A%7D
@@ -753,13 +753,16 @@
 ons.
-delay
+interval
 );%0A 

Update retry.js