lib/Function.js
/**
 * Attach control flow methods to the given task.
 *
 * @param t {task(done)} The task to decorate.
 * @param [withRepeat] {boolean} Pass any truthy value to also attach task repetition methods.
 * @param [abort] {function(reason)} A function that will terminate the execution of the current task composition if it's possible.
 * @returns {task(done)}
 */
Attach control flow methods to the given task.
@param t {task(done)} The task to decorate.
@param [withRepeat] {boolean} Pass any truthy value to also attach task repetition methods.
@param [abort] {function(reason)} A function that will terminate the execution of the current task composition if it's possible.
Attach control flow methods to the given task . @param t { task ( done ) } The task to decorate . @param [ withRepeat ] { boolean } Pass any truthy value to also attach task repetition methods . @param [ abort ] { function ( reason ) } A function that will terminate the execution of the current task composition if it ' s possible .
function decorateTask(t, withRepeat, abort) {
    var desc = {
        retry:    { get: function () { return retry.bind(t) } },
        fallback: { get: function () { return fallback.bind(t) } }
    }
    if(!withRepeat) {
        desc.timeout = { get: function () { return timeout.bind(t) } }
        if(!t.abort)
            desc.abort = { value: abort || t.abort || noop }
    }
    Object.defineProperties(t, desc)
    return withRepeat ? decorateTaskWithRepeat(t, abort) : t
}
function decorateTask ( t , withRepeat , abort ) { var desc = { retry : { get : function ( ) { return retry . bind ( t ) } } , fallback : { get : function ( ) { return fallback . bind ( t ) } } } if ( ! withRepeat ) { desc . timeout = { get : function ( ) { return timeout . bind ( t ) } } if ( ! t . abort ) desc . abort = { value : abort || t . abort || noop } } Object . defineProperties ( t , desc ) return withRepeat ? decorateTaskWithRepeat ( t , abort ) : t }
Attach control flow methods to the given task.
Attach control flow methods to the given task .