lib/internal/task.js
function setListener(callback) {
    if (onFinish) {
      throw new Error('thenDo/finally called more than once');
    }
    if (finished) {
      onFinish = function() {};
      callback(finished.err, finished.result);
    } else {
      onFinish = function() {
        callback(finished.err, finished.result);
      };
    }
  }
function setListener(callback) {
    if (onFinish) {
      throw new Error('thenDo/finally called more than once');
    }
    if (finished) {
      onFinish = function() {};
      callback(finished.err, finished.result);
    } else {
      onFinish = function() {
        callback(finished.err, finished.result);
      };
    }
  }
function setListener ( callback ) { if ( onFinish ) { throw new Error ( 'thenDo/finally called more than once' ) ; } if ( finished ) { onFinish = function ( ) { } ; callback ( finished . err , finished . result ) ; } else { onFinish = function ( ) { callback ( finished . err , finished . result ) ; } ; } }
Sets the listener that will be called with the result of this task, when
finished. This function can be called at most once.

@param {function(?, T)} callback
Sets the listener that will be called with the result of this task when finished . This function can be called at most once .