Stores a promise  in a thenable so that it fires only
when used. Calling Promise.reject(error) otherwise throws a global error.
function StoredPromise(init) {
  this._resolve = value => {
    this._resolved = true;
    this._value    = value
  }
  this._reject  = value => {
    this._rejected = true;
    this._value    = value;
  }

  init(
    value => {
      this._resolve(value)
    },
    value => {
      this._reject(value)
    }
  );
}