import _defineProperty from "@babel/runtime/helpers/defineProperty";
let tmpResolve;
let tmpReject;

/**
 * Creates a promise where resolve can be manually executed
 */
class ManualPromise extends Promise {
  constructor(value) {
    super((resolve, reject) => {
      tmpResolve = resolve;
      tmpReject = reject;
    });
    _defineProperty(this, "_resolve", () => {});
    _defineProperty(this, "_reject", () => {});
    this.value = value;
    this._resolve = tmpResolve;
    this._reject = tmpReject;
  }
  resolve(value) {
    this._resolve(value !== null && value !== void 0 ? value : this.value);
    return this;
  }
  reject(err) {
    this._reject(err !== null && err !== void 0 ? err : new Error('Manually rejected'));
    return this;
  }
  static get [Symbol.species]() {
    return Promise;
  }
  get [Symbol.toStringTag]() {
    return 'ManualPromise';
  }
}
export default ManualPromise;