code: function(future,
                          fulfillCallbacks,
                          rejectCallbacks,
                          setValue,
                          setError,
                          setState) {
    var isResolved = false;
  
    var resolver = this;
    var fulfill = function(value) {
      // console.log("queueing fulfill with:", value);
      async(function() {
        setState("fulfilled");
        setValue(value);
        // console.log("fulfilling with:", value);
        fulfillCallbacks.pump(value);
      });
    };
    var reject = function(reason) {
      // console.log("queuing reject with:", reason);
      async(function() {
        setState("rejected");
        setError(reason);
        // console.log("rejecting with:", reason);
        rejectCallbacks.pump(reason);
      });
    };
    var resolve = function(value) {
      if (isThenable(value)) {
        value.then(resolve, reject);
        return;
      }
      fulfill(value);
    };
    var ifNotResolved = function(func, name) {
      return function(value) {
        if (!isResolved) {
          isResolved = true;
          func(value);
        } else {
          if (typeof console != "undefined") {
            console.error("Cannot resolve a Promise multiple times.");
          }
        }
      };
    };
  
    // Indirectly resolves the Promise, chaining any passed Promise's resolution
    this.resolve = ifNotResolved(resolve, "resolve");
  
    // Directly fulfills the future, no matter what value's type is
    this.fulfill = ifNotResolved(fulfill, "fulfill");
  
    // Rejects the future
    this.reject = ifNotResolved(reject, "reject");
  
    this.cancel  = function() { resolver.reject(new Error("Cancel")); };
    this.timeout = function() { resolver.reject(new Error("Timeout")); };
  
    if (underTest) {
      Object.defineProperties(this, {
        _isResolved: _readOnlyProperty(function() { return isResolved; }),
      });
    }
  
    setState("pending");
  }
docs: Resolver Constuctor