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

Return ReadableStream #21

Closed
jimmywarting opened this issue Sep 16, 2016 · 4 comments
Closed

Return ReadableStream #21

jimmywarting opened this issue Sep 16, 2016 · 4 comments

Comments

@jimmywarting
Copy link

How about actually get a ReadableStream back instead of writing a own custom onChunk callback

With ReadableStream you would be able to pipeTo & pipeThrogh others streams
With web-stream-polyfill (npm) this would be a breeze

@jimmywarting
Copy link
Author

with regards to #19 (cancellation) the way you would do it with ReadableStream is by calling .error() that would trigger xhr.abort

@jimmywarting
Copy link
Author

Played a bit myself with streams and monkey patching xhr:

This is how i would do it for firefox: https://jsfiddle.net/98L105v3/2/

@jonnyreeves
Copy link
Owner

jonnyreeves commented Sep 17, 2016

Thanks @jimmywarting this was an excellent suggestion; I've incorporated your ideas into #20 - I would appreciate your feedback and also any input you and @ariutta have on the future surface API of this library.

@jimmywarting
Copy link
Author

Now when i look back at my monkey patch I like it since you can choose to overide it or get a new extended xhr (:

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