AbortController is missing
See original GitHub issueIs this a bug report?
Yes. AbortController is a new spec (you can find info here: https://developers.google.com/web/updates/2017/09/abortable-fetch)
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: Linux 4.13
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.0.0 => 16.2.0
react-native: ^0.53.0 => 0.53.0
Steps to Reproduce
- Istantiate an AbortController
- Write a fetch request passing the signal
- Try to abort the fetch request
Expected Behavior
The requested behaviour is to abort the fetch request.
Actual Behavior
Nothing happens
Reproducible Demo
Something like this:
const controller = new AbortController();
const signal = controller.signal;
setTimeout(() => controller.abort(), 5000);
fetch(url, { signal }).then(response => {
return response.text();
}).then(text => {
console.log(text);
});
My question is a technical one: is the react native core that needs to be updated in order to support this? Or is it something that babel can patch with a new version?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:31 (7 by maintainers)
Top Results From Across the Web
AbortController missing in TypeScript - fetch api - Stack Overflow
It's because you are missing the value DOM in the lib array of your tsconfig.json. If you check the official repo, you will...
Read more >The complete guide to AbortController in Node.js
The AbortController API in Node.js is a wonderful new development - learn all about it in this comprehensive tutorial.
Read more >node-abort-controller - npm
AbortController for Node based on EventEmitter. Latest version: 3.0.1, last published: a year ago. Start using node-abort-controller in your ...
Read more >How to Cancel Promise with AbortController - LeanyLabs
Many APIs require an abort mechanism that's missing from the language. Before the standard, every library had to roll their custom solutions to...
Read more >abort-controller - npm Package Health Analysis - Snyk
Learn more about abort-controller: package health score, popularity, security, maintenance, ... Looks like abort-controller is missing a security policy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great, it works! I’m not on a create react app, but I’ve just followed the instruction for it (I’m actually on a react-native project not even on a create react native app
So installed the module, imported it like this:
and then used it like this:
I’d not close the issue, because we’re still waiting for the official spec. Thank you @chirag04 for linking me the right resource ☺️
Support for this was included in the new version; 0.60, which was released yesterday.
https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#060