Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce readable stream controller class #310

Merged
merged 1 commit into from
Mar 31, 2015
Merged

Introduce readable stream controller class #310

merged 1 commit into from
Mar 31, 2015

Conversation

domenic
Copy link
Member

@domenic domenic commented Mar 31, 2015

Instead of creating enqueue, close, and error functions per-stream, and passing (some subset of them) to the underlying source's start() and pull() methods, we instead create an instance of the ReadableStreamController class, which has methods enqueue(), close(), and error().

This closes #309, which contains more discussion and justification. It sets the stage for #301 (which will work by adding another property to the ReadableStreamController class).

Spec should be available for review at https://streams.spec.whatwg.org/branch-snapshots/rs-controller when the build completes.

return {
close() {},
enqueue(chunk) { },
error(e) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nitpicking: use either of {} or { }?

@tyoshino
Copy link
Member

lgtm a62b4f3

@tyoshino
Copy link
Member

Took a look at all the diff lines. I'm not sure if there some t.throws based tests remain not-converted since even if you forget to update a variable (enqueue, etc) that was holding a closure is set to undefined by mistake, calling the variable may throw a TypeError.

@domenic
Copy link
Member Author

domenic commented Mar 31, 2015

Great idea. I did a search for /TypeError/ and it looks like we're clear. But much appreciated.

Instead of creating enqueue, close, and error functions per-stream, and passing (some subset of them) to the underlying source's start() and pull() methods, we instead create an instance of the ReadableStreamController class, which has methods enqueue(), close(), and error().

This closes #309, which contains more discussion and justification. It sets the stage for #301 (which will work by adding another property to the ReadableStreamController class).
@domenic domenic merged commit 4a9b2ec into master Mar 31, 2015
@domenic domenic deleted the rs-controller branch March 31, 2015 15:37
domenic added a commit to domenic/fetch-with-streams that referenced this pull request Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Making the "queue manipulator" its own class
2 participants