Bliss.fetch doesn't expose the xhr, so cannot call abort()
See original GitHub issueHi, I’d like to sometimes abort an ongoing HTTP request, by calling xhr.abort()
. But Bliss.fetch()
returns a Promise only, via which I cannot access xhr.abort()
( https://github.com/LeaVerou/bliss/blob/gh-pages/bliss.shy.js#L374 )
What do you think about somehow making xhr.abort()
accessible? or the whole xhr
.
And how can that best be done? My first thought was to add an abort()
function on the returned promise, but that doesn’t work so well, because it disappears when chaining with .then(...)
.
(Currently I’ve done a quick hack in bliss.shy.js
: I added xhr
as a field on the promise, although it disappears when calling then()
.)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Aborting does not abort the XHR · Issue #663 · github/fetch
The onabort event handler returns an AbortError per the Fetch spec, but it doesn't cancel the network activity as it's required to.
Read more >How to abort XMLHttpRequest if taking a lot of time to load?
To abort simply use xhr.abort() method and it will cancel your request. Also as you don't want it to cancel unless it's working...
Read more >Cross-domain AJAX using Flash · Curiosity is bliss
You can look at the source of the page for the detailled APIs exposed by the Flash object, the main ones being "fs.XmlHttp(urlString, ......
Read more >How to Abort a Fetch Request - YouTube
There will be times when you want to tell the browser to stop a fetch call. We can achieve this with an AbortController....
Read more >Aborting a fetch request
An abortable XHR request looks something like this. let xhr = new XMLHttpRequest(); xhr.method ...
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 Free
Top 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
Closing this then, since the PR got merged. B.t.w. now I’ve ported the essential parts of my app from jQuery, to mainly React, + some Bliss also :- )
Ok, I’ll do :- ) … (a week later) Done, see PR referenced below: