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

Add signal to RequestProperties #3

Open
sWW26 opened this issue Feb 19, 2019 · 2 comments
Open

Add signal to RequestProperties #3

sWW26 opened this issue Feb 19, 2019 · 2 comments

Comments

@sWW26
Copy link

sWW26 commented Feb 19, 2019

I wanted to be able to abort fetches while using these bindings but realised it doesn't have support for the signal property. I made a start at implementing it however I realised its AbortController hasn't been implemented in Node.js as far as I can tell so isn't possible to test it. Does this browser specific binding belong in this library or are you trying to keep it as generic as possible? If it doesn't belong here what would be a good approach to making it available to use?

https://developer.mozilla.org/en-US/docs/Web/API/AbortController

@whitetigle
Copy link

Hi,
while I don't have an answer myself regarding the fable-fetch goals, I have been using request-promise for a while on Node.js 10.x which seems to allow an abort mechanism. (request/request-promise#85). Is that what you're looking for?

@alfonsogarciacaro
Copy link
Member

As far as I know, the fetch API is not supported natively in node.js and you need a library for it. node-fetch at least seems to support AbortController (using another library): https://www.npmjs.com/package/node-fetch#request-cancellation-with-abortsignal

Maybe you could create a package for AbortController and add a dependency to it here. You can also PR to fable-browser to add such a package.

Thinking about this and compatibility with node.js, this library assumes that fetch is a global value. Maybe we should make it easier for users to define an imported module like node-fetch instead.

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

3 participants