Re: [streams] WIP: exclusive reader interface (#251)

> +      throw new TypeError('This stream has already been locked for exclusive reading by another reader');
> +    }
> +
> +    setReader(stream, this);
> +
> +    this._stream = stream;
> +    this._getReader = getReader;
> +    this._setReader = setReader;
> +
> +    this._lockReleased = new Promise(resolve => {
> +      this._lockReleased_resolve = resolve;
> +    });
> +  }
> +
> +  get ready() {
> +    EnsureStreamReaderIsExclusive(this);

This function throws when the stream is not locked by `this`, right?
I think returning a rejected Promise is good, as written in https://github.com/domenic/promises-unwrapping/blob/master/docs/writing-specifications-with-promises.md#promise-returning-functions-should-never-throw.

ditto for `.closed` and `cancel()`.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/251/files#r21659067

Received on Thursday, 11 December 2014 05:43:14 UTC