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

Should there be a WritableStream.close() method? #1007

Closed
mkruisselbrink opened this issue Aug 1, 2019 · 5 comments · Fixed by #1011
Closed

Should there be a WritableStream.close() method? #1007

mkruisselbrink opened this issue Aug 1, 2019 · 5 comments · Fixed by #1011

Comments

@mkruisselbrink
Copy link

It appears that currently the only way to close (without aborting) a writable stream is by calling getWriter, and then calling close() on that writer. Would it make sense to also expose close() directly on WritableStream itself?

Presumably you'd only be able to call such a method if the stream isn't locked (just like abort on the stream can only be called if the stream isn't locked).

@ricea
Copy link
Collaborator

ricea commented Aug 2, 2019

close() is certainly the odd-one-out here, as both cancel() and abort() have versions that operate on plain unlocked objects.

On the other hand, I don't find the cancel() and abort() variants all that useful anyway. Writing writable.getWriter().close() is not a terrible burden.

I assume this was a conscious choice when WritableStream was converted to be lockable. @domenic, do you happen to remember what the motivation was?

@domenic
Copy link
Member

domenic commented Aug 2, 2019

It looks like this was more of a historical accident than anything. We intended to add close in #319, but I guess the initial pull requests didn't do so. I'd like to add it.

@ricea
Copy link
Collaborator

ricea commented Aug 2, 2019

Okay. I have no objection. I'm hoping some enthusiastic person will step up with a PR 😄

@MattiasBuelens
Copy link
Collaborator

I'll pick this up. Should be simple enough. 🙂

@ricea
Copy link
Collaborator

ricea commented Oct 18, 2019

Fixed in #1011.

@ricea ricea closed this as completed Oct 18, 2019
domenic pushed a commit that referenced this issue Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants