function Promise(name, data) {
    this.name = name;
    this.isRejected = false;
    this.error = null;
    // If you build a promise and pass in some data it's already resolved.
    if (data != null) {
      this.isResolved = true;
      this._data = data;
      this.hasData = true;
    } else {
      this.isResolved = false;
      this._data = EMPTY_PROMISE;
    }
    this.callbacks = [];
    this.errbacks = [];
    this.progressbacks = [];
  }
If `data` is passed in this constructor, the promise is created resolved.
If there isn't data, it isn't resolved at the beginning.