Re: [streams] Byte stream update, including reference implementation (#361)

> +      return Promise.reject(this._storedError);
> +    }
> +
> +    assert(this._ownerReadableByteStream !== undefined, 'This stream must be attached to a stream');
> +
> +    return CancelReadableByteStream(this._ownerReadableByteStream, reason);
> +  }
> +
> +  read(view) {
> +    if (!IsReadableByteStreamByobReader(this)) {
> +      return Promise.reject(
> +        new TypeError(
> +            'ReadableByteStreamByobReader.prototype.read can only be used on a ReadableByteStreamByobReader'));
> +    }
> +
> +    if (view === undefined) {

I realize the above may be confusing since I am talking mostly about how to write the spec while commenting on the code. For the code, I think just use `ArrayBuffer.isView` here, and then continue using `.byteLength` etc. as below.

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

Received on Thursday, 11 June 2015 21:02:58 UTC