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

Allow stream reader cancel() method to return bytes from queue instead of discarding them. #146

Closed
DarDoro opened this issue Jul 18, 2021 · 1 comment

Comments

@DarDoro
Copy link

DarDoro commented Jul 18, 2021

There are no benefits from returning {value: undefined, done: true} after "cancel()" and discarding already received bytes.

Returning {value: byes_read_so_far, done: true} will act much better, allowing to implement timeout and preserving data.
Also, "cancel()" implemented this way will be compatible with the current implementation. When done=true, "readable" will be unlocked. For "value" not eq. "undefined" the last chunk will be reliable processed.
It's possibly the "lowest hanging fruit" for many similar requests.
It will partially fulfill other requests eg. #1103
whatwg/fetch#180

@reillyeon
Copy link
Collaborator

I'm going to reopen the Streams API version of this issue because the behavior of the cancel() method is not defined by the Web Serial API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants