Comments (10)
I'm not sure what this issue's goal.
This is not the polyfill of the fetch
API. This is an isomorphic implementation of AbortController
API. The fetch
API is merely one of APIs which depend on the AbortController
API. The AbortController
API does not depend on the fetch
API. The dependency is not bi-directional.
from abort-controller.
For example, if you want to implement a polyfill of the whole fetch
API, you can use this package, then it may reduce duplicate code with the polyfills of other APIs which depend on AbortController
(AbortController
is a standard API for aborting asynchronous jobs in WHATWG layer). Especially, if the polyfill aims at isomorphic, this package would be useful since this works on Node.js as well.
Of course, if you are interested in only modern browsers, you don't need this package.
from abort-controller.
from abort-controller.
I'm sorry for the overlook.
You can use this package on browsers normally. Just import it by a script element or use Webpack or something like.
AbortController
provides the feature that notifies abort
events to subscribers. It's all. This shim doesn't touch what the subscribers of abort
event do.
from abort-controller.
@mysticatea So you're saying that if I fetch something in Internet Explorer 6, this AbortController will be able to abort that request? I am asking what browsers this gives functionality to that don't already support AbortController. I know that abort is not supported by many browsers, so I am wondering how many browsers this is capable of giving abort functionality to. Or maybe I am misunderstanding the purpose of the repo.
from abort-controller.
No. This is an implementation of AbortController
API, but this is not a polyfill of fetch
. The fetch
API accepts signal
option and subscribes the abort
event, but it's a feature of the fetch
API.
from abort-controller.
@mysticatea So right now, I am able to use AbortController
as built into Chrome. Why import an implementation of AbortController
when the browser already supports it?
I presume the reason is to polyfill browsers that support abort but not AbortController.
from abort-controller.
AbortController is an independent API for all features which need to abort ongoing activities. In the spec, Aborting ongoing activities section mentions it.
Originally, people have needed the standard way to cancel asynchronous jobs, and it had discussed as cancellable promises in TC39. However, the cancellable promises spec had been withdrawn. So people defined the standard way in WHATWG.
I think there are several APIs need the way which aborts asynchronous jobs. It's convenient if the way is common in all Web APIs. And WHATWG mentions that AbortController is the common way.
I expect the polyfills of the APIs which depend on AbortController to use this package rather than each polyfill implements it.
from abort-controller.
@mysticatea Maybe this is more clear:
Do you know which browser versions support signals on fetch (fetch(..., { signal: ...})
) but do not support AbortController
?
This is essentially a polyfill for AbortController
, right? If AbortController
isn't defined in your browser, this defines it. AbortController
comes built into Chrome 66, Edge 16, Firefox 57, Opera 43, and Safari 11.1.
If I am using one of the aforementioned browsers that innately supports AbortController
, this package is unnecessary, right?
This package is for browsers that do not have support for AbortController
already built in.
My question is, if a browser does not innately support AbortController
, why define it?
I am under the impression that a browser that does not innately support AbortController
also does not support the signal
option on fetch
.
What does a polyfill of AbortController
do if it can't abort a fetch request?
Are there browsers that can abort a fetch request but do not have AbortController
built in?
from abort-controller.
I am under the impression that any browser that supports the signal
option of fetch
already supports AbortController
without a polyfill. And that any browser that does not have AbortController
innately available does not support the signal
option of fetch
.
That is to say that adding an AbortController
polyfill does nothing if the browser does not support signal
on fetch
in the first place. For example, Chrome 65 does not have innate AbortController
support. Using this polyfill does not allow fetch
to be aborted, because the signal
option of fetch
is completely ignored.
Why polyfill it if it does nothing?
Are there browsers that do have signal
support on fetch
but do not have AbortController
innately available?
Again, for example, I used this polyfill on Chrome 65, and it did nothing, because Chrome 65 does not support signal
on fetch
.
On Chrome 66, where signal
is a supported option of fetch
, AbortController
is already defined innately, and so this polyfill still does nothing.
from abort-controller.
Related Issues (20)
- Change `ev` parameter to `Event` once TS3.4 comes out HOT 2
- not working in IE 11 because the dist files are not transpiled to ES5 HOT 5
- TypeScript support is broken HOT 1
- ES-check error HOT 3
- umdOutro causes issues with webpack+babel HOT 1
- Add extension to package.json:main HOT 1
- AbortController as part of Node.js core
- Use native AbortController when possible. HOT 1
- can't ever reset a signal once it's been aborted HOT 2
- ie is not supported for this. how could we handle this problem ? HOT 1
- Update the event-target-shim dependency
- Unable to timeout Promise.
- Browser code missing named AbortController export
- Support for AbortSignal.reason HOT 1
- Add a ponyfill export
- Support for `AbortSignal.timeout` HOT 1
- TypeScript error: "Type 'AbortSignal' is missing the following properties from type 'AbortSignal': reason, throwIfAborted" HOT 5
- controller.signal.constructor.name is invalid? HOT 3
- ModuleNotFoundError on export HOT 1
- Broken on node 18.14.2 and 19.16.1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abort-controller.